Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,24 +10,24 @@ from Gradio_UI import GradioUI
|
|
10 |
duckduckgo_tool=DuckDuckGoSearchTool()
|
11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
@tool
|
13 |
-
def animewatcher(anime_name:str)-> str:
|
14 |
-
|
15 |
-
"""A tool that does search the details abt a given anime using duckduckgo
|
16 |
Args:
|
17 |
anime_name: The name of the anime to search for.
|
18 |
"""
|
19 |
-
# return "What magic will you build ?"
|
20 |
try:
|
21 |
-
search_query=f"{anime_name} anime details
|
22 |
-
|
23 |
if not results:
|
24 |
-
return "No results found for the given anime. Maybe
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
28 |
return response.strip()
|
|
|
29 |
except Exception as e:
|
30 |
-
return f"Error searching for '{anime_name}':{str(e)}"
|
31 |
|
32 |
@tool
|
33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
10 |
duckduckgo_tool=DuckDuckGoSearchTool()
|
11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
@tool
|
13 |
+
def animewatcher(anime_name: str) -> str:
|
14 |
+
"""A tool that searches for anime details using DuckDuckGo.
|
|
|
15 |
Args:
|
16 |
anime_name: The name of the anime to search for.
|
17 |
"""
|
|
|
18 |
try:
|
19 |
+
search_query = f"{anime_name} anime details"
|
20 |
+
results = duckduckgo_tool(search_query, max_results=3) # Fix: `results` instead of `result`
|
21 |
if not results:
|
22 |
+
return "No results found for the given anime. Maybe it's underrated!"
|
23 |
+
|
24 |
+
response = f"Here are some details about '{anime_name}':\n"
|
25 |
+
for i, result in enumerate(results, 1): # Fix: Iterate over `results`
|
26 |
+
response += f"{i}. **{result['title']}**\n{result['href']}\n\n"
|
27 |
return response.strip()
|
28 |
+
|
29 |
except Exception as e:
|
30 |
+
return f"Error searching for '{anime_name}': {str(e)}"
|
31 |
|
32 |
@tool
|
33 |
def get_current_time_in_timezone(timezone: str) -> str:
|