mettaleb15 commited on
Commit
c3657dd
·
verified ·
1 Parent(s): f2a3146

Update app.py

Browse files

Add tool to convert address to latitude

Files changed (1) hide show
  1. app.py +8 -3
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
- """Un outil qui récupère la latitude correspondant à une adresse postale donnée.
 
14
  Arguments:
15
- address: L'adresse complète à géocoder (ex: '10 Downing Street, London' ou 'Tour Eiffel, Paris').
 
 
 
16
  """
17
  try:
18
- # Appel à l'API Nominatim d'OpenStreetMap
 
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"}