Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,16 @@ def translate_english_to_french(text: str) -> str:
|
|
| 40 |
|
| 41 |
@tool
|
| 42 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 43 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
try:
|
| 45 |
tz = pytz.timezone(timezone)
|
| 46 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -49,6 +58,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 49 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 50 |
|
| 51 |
|
|
|
|
| 52 |
final_answer = FinalAnswerTool()
|
| 53 |
|
| 54 |
model = HfApiModel(
|
|
|
|
| 40 |
|
| 41 |
@tool
|
| 42 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 43 |
+
"""
|
| 44 |
+
Fetches the current local time for a given timezone.
|
| 45 |
+
|
| 46 |
+
Args:
|
| 47 |
+
timezone (str): A valid IANA timezone string
|
| 48 |
+
(for example: "America/New_York", "Europe/Paris", "Africa/Lagos").
|
| 49 |
+
|
| 50 |
+
Returns:
|
| 51 |
+
str: The current local time in the specified timezone.
|
| 52 |
+
"""
|
| 53 |
try:
|
| 54 |
tz = pytz.timezone(timezone)
|
| 55 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
| 58 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 59 |
|
| 60 |
|
| 61 |
+
|
| 62 |
final_answer = FinalAnswerTool()
|
| 63 |
|
| 64 |
model = HfApiModel(
|