Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdd tool to convert address to latitude
app.py
CHANGED
|
@@ -10,12 +10,17 @@ from Gradio_UI import GradioUI
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_latitude_from_address(address: str) -> str:
|
| 13 |
-
"""
|
|
|
|
| 14 |
Arguments:
|
| 15 |
-
address: L'adresse complète à géocoder (ex: '10 Downing Street, London' ou 'Tour Eiffel, Paris').
|
|
|
|
|
|
|
|
|
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
-
|
|
|
|
| 19 |
url = "https://nominatim.openstreetmap.org/search"
|
| 20 |
params = {"q": address, "format": "json", "limit": 1}
|
| 21 |
headers = {"User-Agent": "smolagents-geocoder/1.0"}
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_latitude_from_address(address: str) -> str:
|
| 13 |
+
"""Récupère la latitude (et longitude) correspondant à une adresse postale donnée.
|
| 14 |
+
|
| 15 |
Arguments:
|
| 16 |
+
address (str): L'adresse complète à géocoder (ex: '10 Downing Street, London' ou 'Tour Eiffel, Paris').
|
| 17 |
+
|
| 18 |
+
Retour:
|
| 19 |
+
str: Une chaîne contenant la latitude et la longitude correspondantes.
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
+
import requests
|
| 23 |
+
|
| 24 |
url = "https://nominatim.openstreetmap.org/search"
|
| 25 |
params = {"q": address, "format": "json", "limit": 1}
|
| 26 |
headers = {"User-Agent": "smolagents-geocoder/1.0"}
|