Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,13 +17,17 @@ def animewatcher(anime_name: str) -> str:
|
|
| 17 |
"""
|
| 18 |
try:
|
| 19 |
search_query = f"{anime_name} anime details"
|
| 20 |
-
results = duckduckgo_tool(search_query) #
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
if not results:
|
| 23 |
return f"No results found for '{anime_name}'. Maybe it's underrated!"
|
| 24 |
|
| 25 |
-
# Limit results to 3
|
| 26 |
-
results = results[:3]
|
| 27 |
|
| 28 |
response = f"Here are some details about '{anime_name}':\n"
|
| 29 |
for i, result in enumerate(results, 1):
|
|
|
|
| 17 |
"""
|
| 18 |
try:
|
| 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
|
| 30 |
+
results = results[:3]
|
| 31 |
|
| 32 |
response = f"Here are some details about '{anime_name}':\n"
|
| 33 |
for i, result in enumerate(results, 1):
|