Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,37 +8,7 @@ from tools.final_answer import FinalAnswerTool
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
-
@tool
|
12 |
-
def tool_ricerca_panini(city:str) -> str: #it's import to specify the return type
|
13 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
-
"""A tool that searches for the best sandwiches in Italian cities.
|
15 |
-
Args:
|
16 |
-
city: A string representing a city in Italy (e.g., 'Milan/Turin')
|
17 |
-
"""
|
18 |
-
try:
|
19 |
-
# Costruisce la query di ricerca
|
20 |
-
query = f"miglior panino {city} Italia"
|
21 |
-
# Esegui la ricerca con DuckDuckGo
|
22 |
-
results = DuckDuckGoSearchTool.search(query=query)
|
23 |
-
top_result = results[0]
|
24 |
-
return f"Il miglior panino a {city.title()} sembra essere {top_result['title']}."
|
25 |
-
except Exception as e:
|
26 |
-
return f"Errore nel trovare il tuo panino a {city}: {str(e)} :("
|
27 |
|
28 |
-
@tool
|
29 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
30 |
-
"""A tool that fetches the current local time in a specified timezone.
|
31 |
-
Args:
|
32 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
33 |
-
"""
|
34 |
-
try:
|
35 |
-
# Create timezone object
|
36 |
-
tz = pytz.timezone(timezone)
|
37 |
-
# Get current time in that timezone
|
38 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
39 |
-
return f"The current local time in {timezone} is: {local_time}"
|
40 |
-
except Exception as e:
|
41 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
42 |
|
43 |
|
44 |
final_answer = FinalAnswerTool()
|
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
final_answer = FinalAnswerTool()
|