Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,14 +31,20 @@ def get_approximate_integral(
|
|
| 31 |
|
| 32 |
@tool
|
| 33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 34 |
-
"""
|
|
|
|
|
|
|
|
|
|
| 35 |
try:
|
|
|
|
| 36 |
tz = pytz.timezone(timezone)
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
except Exception as e:
|
| 40 |
-
return f"Error: {e}"
|
| 41 |
|
|
|
|
| 42 |
final_answer = FinalAnswerTool()
|
| 43 |
|
| 44 |
model = HfApiModel(
|
|
|
|
| 31 |
|
| 32 |
@tool
|
| 33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 34 |
+
"""A tool that fetches the current local time in a specified timezone.
|
| 35 |
+
Args:
|
| 36 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 37 |
+
"""
|
| 38 |
try:
|
| 39 |
+
# Create timezone object
|
| 40 |
tz = pytz.timezone(timezone)
|
| 41 |
+
# Get current time in that timezone
|
| 42 |
+
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 43 |
+
return f"The current local time in {timezone} is: {local_time}"
|
| 44 |
except Exception as e:
|
| 45 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 46 |
|
| 47 |
+
|
| 48 |
final_answer = FinalAnswerTool()
|
| 49 |
|
| 50 |
model = HfApiModel(
|