Update app.py
Browse files
app.py
CHANGED
|
@@ -9,16 +9,20 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def get_location_name_from_lat_lon(lat:int, lon:int)-> str:
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
Args:
|
| 16 |
lat: latitude of the location
|
| 17 |
-
lon:
|
| 18 |
"""
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def get_location_name_from_lat_lon(lat: int, lon: int) -> str:
|
| 13 |
+
"""
|
| 14 |
+
A tool that gets the location name from latitude and longitude information.
|
| 15 |
+
|
| 16 |
Args:
|
| 17 |
lat: latitude of the location
|
| 18 |
+
lon: longitude of the location
|
| 19 |
"""
|
| 20 |
+
# Example: call a reverse geocoding API
|
| 21 |
+
response = requests.get(f"https://api.example.com/reverse?lat={lat}&lon={lon}")
|
| 22 |
+
if response.ok:
|
| 23 |
+
data = response.json()
|
| 24 |
+
return data.get("location", "Unknown location")
|
| 25 |
+
return "Error retrieving location"
|
| 26 |
|
| 27 |
@tool
|
| 28 |
def get_current_time_in_timezone(timezone: str) -> str:
|