Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,17 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 30 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 31 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
@tool
|
| 34 |
def weather_art(timezone: str, local_time: str)-> str: #it's import to specify the return type
|
| 35 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
|
|
|
| 30 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 31 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 32 |
|
| 33 |
+
@tool
|
| 34 |
+
def guess_city_for_timezone(timezone: str) -> str:
|
| 35 |
+
# Could do a minimal lookup or a real search, for example:
|
| 36 |
+
known_timezones_to_cities = {
|
| 37 |
+
"America/Los_Angeles": "Los Angeles",
|
| 38 |
+
"America/New_York": "New York",
|
| 39 |
+
"UTC-8": "Some West Coast city (e.g. Seattle)"
|
| 40 |
+
# ...
|
| 41 |
+
}
|
| 42 |
+
return known_timezones_to_cities.get(timezone, "Unknown City")
|
| 43 |
+
|
| 44 |
@tool
|
| 45 |
def weather_art(timezone: str, local_time: str)-> str: #it's import to specify the return type
|
| 46 |
#Keep this format for the description / args / args description but feel free to modify the tool
|