Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,39 +9,19 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
#Marathon training plan
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
"""
|
| 14 |
-
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
Returns:
|
| 19 |
-
A link to a training plan or summary of key details.
|
| 20 |
-
"""
|
| 21 |
-
search_tool = DuckDuckGoSearchTool()
|
| 22 |
-
query = f"marathon training plan {goal_time} site:runnersworld.com"
|
| 23 |
-
results = search_tool.search(query)
|
| 24 |
-
|
| 25 |
-
if results:
|
| 26 |
-
return f"Here is a recommended training plan for {goal_time}: {results[0]['url']}"
|
| 27 |
-
else:
|
| 28 |
-
return f"Could not find a specific plan for {goal_time}, but you can check Runner's World for more details."
|
| 29 |
-
|
| 30 |
-
@tool
|
| 31 |
-
def fetch_european_marathons_2025() -> str:
|
| 32 |
-
"""Fetches a list of marathons in Europe for 2025.
|
| 33 |
-
|
| 34 |
-
Returns:
|
| 35 |
-
A link to a webpage or a summary of key details.
|
| 36 |
"""
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
return f"
|
| 43 |
-
|
| 44 |
-
return "
|
| 45 |
|
| 46 |
final_answer = FinalAnswerTool()
|
| 47 |
|
|
|
|
| 9 |
|
| 10 |
#Marathon training plan
|
| 11 |
@tool
|
| 12 |
+
def get_current_time_in_timezone(timezone: str) -> str:
|
| 13 |
+
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 14 |
Args:
|
| 15 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"""
|
| 17 |
+
try:
|
| 18 |
+
# Create timezone object
|
| 19 |
+
tz = pytz.timezone(timezone)
|
| 20 |
+
# Get current time in that timezone
|
| 21 |
+
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 22 |
+
return f"The current local time in {timezone} is: {local_time}"
|
| 23 |
+
except Exception as e:
|
| 24 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 25 |
|
| 26 |
final_answer = FinalAnswerTool()
|
| 27 |
|