Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
|
@@ -18,6 +19,23 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
+
from timezonefinder import TimezoneFinder
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
|
|
|
| 19 |
"""
|
| 20 |
return "What magic will you build ?"
|
| 21 |
|
| 22 |
+
|
| 23 |
+
@tool
|
| 24 |
+
def get_current_time_in_location(lng:float, lat:float)-> str: #it's import to specify the return type
|
| 25 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 26 |
+
"""A tool that fetches the current local time at a specified (longitude, latitude)
|
| 27 |
+
Args:
|
| 28 |
+
lng: A float representing the longitude
|
| 29 |
+
lat: A float representing the latitude
|
| 30 |
+
"""
|
| 31 |
+
try:
|
| 32 |
+
tf = TimezoneFinder()
|
| 33 |
+
# Get current time in that timezone
|
| 34 |
+
return f"The current local time is: {tf.timezone_at(lng, lat)}"
|
| 35 |
+
except Exception as e:
|
| 36 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 37 |
+
|
| 38 |
+
|
| 39 |
@tool
|
| 40 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 41 |
"""A tool that fetches the current local time in a specified timezone.
|