Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,24 +9,24 @@ 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 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
}
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
@tool
|
| 32 |
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 |
+
import geocoder
|
| 13 |
+
|
| 14 |
+
def get_location():
|
| 15 |
+
g = geocoder.ip('me') # Uses the public IP to determine location
|
| 16 |
+
if g.ok:
|
| 17 |
+
return {
|
| 18 |
+
"latitude": g.latlng[0],
|
| 19 |
+
"longitude": g.latlng[1],
|
| 20 |
+
"city": g.city,
|
| 21 |
+
"country": g.country
|
| 22 |
+
}
|
| 23 |
+
else:
|
| 24 |
+
return {"error": "Could not determine location"}
|
|
|
|
| 25 |
|
| 26 |
+
# Example usage
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
location = get_location()
|
| 29 |
+
print(location)
|
| 30 |
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|