Ajeya95 commited on
Commit
767a77b
·
verified ·
1 Parent(s): 5168ccf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -19,11 +19,11 @@ def animewatcher(anime_name: str) -> str:
19
  search_query = f"{anime_name} anime details"
20
  results = duckduckgo_tool(search_query) # Fetch results from DuckDuckGo
21
 
22
- # Check if results is a list, if not return an error
23
- if not isinstance(results, list):
24
- return f"Error: Expected a list of results, but received: {type(results)}"
25
 
26
- if not results:
27
  return f"No results found for '{anime_name}'. Maybe it's underrated!"
28
 
29
  # Limit results to 3 if there are more than 3
 
19
  search_query = f"{anime_name} anime details"
20
  results = duckduckgo_tool(search_query) # Fetch results from DuckDuckGo
21
 
22
+ # Check if results is a string, meaning there may be an error or no results
23
+ if isinstance(results, str):
24
+ return f"Error: The search returned a string instead of a list. Received: {results}"
25
 
26
+ if not isinstance(results, list) or not results:
27
  return f"No results found for '{anime_name}'. Maybe it's underrated!"
28
 
29
  # Limit results to 3 if there are more than 3