GatinhoEducado commited on
Commit
e5aa9ed
·
verified ·
1 Parent(s): 5d2a7fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
  import os
 
8
 
9
  from Gradio_UI import GradioUI
10
 
@@ -19,6 +20,18 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
  """
20
  return "What magic will you build ?"
21
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
24
  """A tool that fetches the current local time in a specified timezone.
 
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
  import os
8
+ from huggingface_hub import list_models
9
 
10
  from Gradio_UI import GradioUI
11
 
 
20
  """
21
  return "What magic will you build ?"
22
 
23
+ @tool
24
+ def model_download_tool(task: str) -> str:
25
+ """
26
+ This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub.
27
+ It returns the name of the checkpoint.
28
+
29
+ Args:
30
+ task: The task for which to get the download count.
31
+ """
32
+ most_downloaded_model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
33
+ return most_downloaded_model.id
34
+
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str:
37
  """A tool that fetches the current local time in a specified timezone.