Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -28,20 +28,6 @@ def magic_eight_ball(question: str) -> str:
|
|
| 28 |
]
|
| 29 |
return random.choice(responses)
|
| 30 |
|
| 31 |
-
@tool
|
| 32 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 33 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 34 |
-
Args:
|
| 35 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 36 |
-
"""
|
| 37 |
-
try:
|
| 38 |
-
# Create timezone object
|
| 39 |
-
tz = pytz.timezone(timezone)
|
| 40 |
-
# Get current time in that timezone
|
| 41 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 42 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 43 |
-
except Exception as e:
|
| 44 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 45 |
|
| 46 |
|
| 47 |
final_answer = FinalAnswerTool()
|
|
|
|
| 1 |
+
from smolagents import CodeAgent,magic_eight_ball,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 28 |
]
|
| 29 |
return random.choice(responses)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
final_answer = FinalAnswerTool()
|