Spaces:
Running
Running
Update most_downloaded_model.py
Browse files- most_downloaded_model.py +0 -19
most_downloaded_model.py
CHANGED
@@ -15,22 +15,3 @@ class HFModelDownloadsTool(Tool):
|
|
15 |
def __call__(self, task: str):
|
16 |
model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
|
17 |
return model.id
|
18 |
-
|
19 |
-
# Push the tool to the Hub
|
20 |
-
tool = HFModelDownloadsTool()
|
21 |
-
tool.push_to_hub("hf-model-downloads")
|
22 |
-
|
23 |
-
# Load the tool from the Hub
|
24 |
-
loaded_tool = Tool.from_hub("hf-model-downloads")
|
25 |
-
|
26 |
-
# Instantiate the HfAgent with the additional tool
|
27 |
-
from transformers import HfAgent
|
28 |
-
|
29 |
-
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[loaded_tool])
|
30 |
-
|
31 |
-
# Run the agent with the new tool
|
32 |
-
result = agent.run(
|
33 |
-
"Can you read out loud the name of the model that has the most downloads in the 'text-to-video' task on the Hugging Face Hub?"
|
34 |
-
)
|
35 |
-
|
36 |
-
print(result)
|
|
|
15 |
def __call__(self, task: str):
|
16 |
model = next(iter(list_models(filter=task, sort="downloads", direction=-1)))
|
17 |
return model.id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|