zvl commited on
Commit
6eb5676
·
verified ·
1 Parent(s): 5353f42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -21
app.py CHANGED
@@ -10,18 +10,16 @@ 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 buscar_datos_gob(term: str, page_size: int, page: int, sort: str) -> dict:
13
- # It's important to specify the return type
14
- # Keep this format for the description / args description but feel free to modify the tool
15
  """A tool that searches for datasets in the API of datos.gob.es.
16
 
17
  Args:
18
  term: The search term to filter the datasets.
19
  page_size: The number of results per page (maximum: 50).
20
  page: The page number for pagination of results.
21
- sort: The field by which to sort the results (default: "title").
22
 
23
  Returns:
24
- A dictionary containing the search results from datos.gob.es API.
25
  """
26
  base_url = "https://datos.gob.es/apidata/catalog/dataset"
27
  params = {
@@ -31,7 +29,7 @@ def buscar_datos_gob(term: str, page_size: int, page: int, sort: str) -> dict:
31
  "_sort": sort
32
  }
33
  headers = {
34
- "Accept": "application/json"
35
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
36
  }
37
 
@@ -43,22 +41,6 @@ def buscar_datos_gob(term: str, page_size: int, page: int, sort: str) -> dict:
43
  return {"error": f"Error in the request: {str(e)}"}
44
 
45
 
46
- @tool
47
- def get_current_time_in_timezone(timezone: str) -> str:
48
- """A tool that fetches the current local time in a specified timezone.
49
- Args:
50
- timezone: A string representing a valid timezone (e.g., 'America/New_York').
51
- """
52
- try:
53
- # Create timezone object
54
- tz = pytz.timezone(timezone)
55
- # Get current time in that timezone
56
- local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
57
- return f"The current local time in {timezone} is: {local_time}"
58
- except Exception as e:
59
- return f"Error fetching time for timezone '{timezone}': {str(e)}"
60
-
61
-
62
  final_answer = FinalAnswerTool()
63
 
64
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
  def buscar_datos_gob(term: str, page_size: int, page: int, sort: str) -> dict:
 
 
13
  """A tool that searches for datasets in the API of datos.gob.es.
14
 
15
  Args:
16
  term: The search term to filter the datasets.
17
  page_size: The number of results per page (maximum: 50).
18
  page: The page number for pagination of results.
19
+ sort: The field by which to sort the results.
20
 
21
  Returns:
22
+ A dictionary containing the search results from the datos.gob.es API.
23
  """
24
  base_url = "https://datos.gob.es/apidata/catalog/dataset"
25
  params = {
 
29
  "_sort": sort
30
  }
31
  headers = {
32
+ "Accept": "application/json",
33
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
34
  }
35
 
 
41
  return {"error": f"Error in the request: {str(e)}"}
42
 
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  final_answer = FinalAnswerTool()
45
 
46
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder: