Synnove commited on
Commit
1913658
·
verified ·
1 Parent(s): a1a0372

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -3,7 +3,7 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
- from meteostat import Point, Monthly
7
  from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
@@ -20,12 +20,13 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
20
  return "What magic will you build ?"
21
 
22
  @tool
23
- def get_current_temperatur_on_location(location: str, day: str)-> str: #it's import to specify the return type
24
  #Keep this format for the description / args / args description but feel free to modify the tool
25
  """A tool that fetches the temperature in celsius in any location on a certain day
26
  Args:
27
- location: A string representing the location (e.g., 'America/New_York')
28
- day: A string representing the valid day to check the temperatur for
 
29
 
30
  """
31
  try:
@@ -36,11 +37,13 @@ def get_current_temperatur_on_location(location: str, day: str)-> str: #it's imp
36
 
37
  #Convert location to Point
38
  # Create Point for New York, NY
39
- tpr = Point(40.78325, -73.96565)
 
 
40
 
41
- # Get monthly data for period
42
- data = Monthly(tpr, start, end)
43
  data = data.fetch()
 
44
  except Exception as e:
45
  return f"Error fetching temperatur for location '{location}': {str(e)}"
46
 
 
3
  import requests
4
  import pytz
5
  import yaml
6
+ from meteostat import Point, Daily
7
  from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
 
20
  return "What magic will you build ?"
21
 
22
  @tool
23
+ def get_current_temperatur_on_location(lat: float, long: float, day: str)-> str: #it's import to specify the return type
24
  #Keep this format for the description / args / args description but feel free to modify the tool
25
  """A tool that fetches the temperature in celsius in any location on a certain day
26
  Args:
27
+ lat: A float to represent the latitude of the location
28
+ long: A float to represent the longitude of the location
29
+ day: A string representing the valid day to check the temperatur for the location
30
 
31
  """
32
  try:
 
37
 
38
  #Convert location to Point
39
  # Create Point for New York, NY
40
+ location = Point(40.7128, -74.0060) # NYC
41
+ start = datetime(2022, 6, 1)
42
+ end = datetime(2022, 6, 2)
43
 
44
+ data = Daily(location, start, end)
 
45
  data = data.fetch()
46
+ print(data['tavg'])
47
  except Exception as e:
48
  return f"Error fetching temperatur for location '{location}': {str(e)}"
49