wowpixels commited on
Commit
bc2cb90
·
verified ·
1 Parent(s): 71191df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ from Gradio_UI import GradioUI
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def compare_weather(arg1:str, arg2:int)-> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """Compares the weather in two cities using OpenWeather API. Returns temperature and description.
16
  Args:
@@ -26,9 +26,9 @@ def compare_weather(arg1:str, arg2:int)-> str: #it's import to specify the retur
26
  url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
27
  res = requests.get(url)
28
  if res.status_code != 200:
29
- return f"{city.title(New York)}: Error - {res.json().get('message', 'unknown error')}"
30
  data = res.json()
31
- return f"{city.title(Paris)}: {data['main']['temp']}°C, {data['weather'][0]['description']}"
32
 
33
  return f"{fetch(city1)}\n\n{fetch(city2)}"
34
  except Exception as e:
 
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
+ def compare_weather(city1:str, city2:int)-> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """Compares the weather in two cities using OpenWeather API. Returns temperature and description.
16
  Args:
 
26
  url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
27
  res = requests.get(url)
28
  if res.status_code != 200:
29
+ return f"{city.title()}: Error - {res.json().get('message', 'unknown error')}"
30
  data = res.json()
31
+ return f"{city.title()}: {data['main']['temp']}°C, {data['weather'][0]['description']}"
32
 
33
  return f"{fetch(city1)}\n\n{fetch(city2)}"
34
  except Exception as e: