Zeltazeus commited on
Commit
ea53b5b
·
verified ·
1 Parent(s): e18d44f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -18,6 +19,18 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from bs4 import BeautifulSoup
8
 
9
  from Gradio_UI import GradioUI
10
 
 
19
  """
20
  return "What magic will you build ?"
21
 
22
+ @tool
23
+ def get_weather(city):
24
+ url = f"https://www.weather.com/weather/today/l/{city}"
25
+ response = requests.get(url)
26
+ soup = BeautifulSoup(response.content, 'html.parser')
27
+ weather_info = soup.find('span', class_='CurrentConditions--tempValue--3KcTQ').text
28
+ return weather_info
29
+
30
+ # Get weather data for Paris
31
+ weather_data = get_weather("Paris")
32
+ print(weather_data)
33
+
34
  @tool
35
  def get_current_time_in_timezone(timezone: str) -> str:
36
  """A tool that fetches the current local time in a specified timezone.