Spaces:
Runtime error
Runtime error
Upload tool
Browse files- app.py +1 -3
- model_downloads.py +5 -1
- requirements.txt +1 -1
- tool_config.json +2 -0
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
from transformers.tools.base import launch_gradio_demo
|
2 |
-
from model_downloads import HFModelDownloadsTool
|
3 |
-
|
4 |
|
5 |
launch_gradio_demo(HFModelDownloadsTool)
|
|
|
1 |
+
from transformers.tools.base import launch_gradio_demo from model_downloads import HFModelDownloadsTool
|
|
|
|
|
2 |
|
3 |
launch_gradio_demo(HFModelDownloadsTool)
|
model_downloads.py
CHANGED
@@ -3,12 +3,16 @@ from huggingface_hub import list_models
|
|
3 |
|
4 |
|
5 |
class HFModelDownloadsTool(Tool):
|
|
|
6 |
description = (
|
7 |
"This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. "
|
8 |
"It takes the name of the category (such as text-classification, depth-estimation, etc), and "
|
9 |
"returns the name of the checkpoint alongside its 30-day download numbers."
|
10 |
)
|
11 |
|
|
|
|
|
|
|
12 |
def __call__(self, task: str):
|
13 |
model = next(iter(list_models(filter=task, sort='downloads', direction=-1)))
|
14 |
-
return f"{model.id} with {model.downloads} downloads over the past 30 days."
|
|
|
3 |
|
4 |
|
5 |
class HFModelDownloadsTool(Tool):
|
6 |
+
name = 'model-download-counter'
|
7 |
description = (
|
8 |
"This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. "
|
9 |
"It takes the name of the category (such as text-classification, depth-estimation, etc), and "
|
10 |
"returns the name of the checkpoint alongside its 30-day download numbers."
|
11 |
)
|
12 |
|
13 |
+
inputs = ['text']
|
14 |
+
outputs = ['text']
|
15 |
+
|
16 |
def __call__(self, task: str):
|
17 |
model = next(iter(list_models(filter=task, sort='downloads', direction=-1)))
|
18 |
+
return f"{model.id} with {model.downloads} downloads over the past 30 days."
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
|
|
1 |
huggingface_hub
|
2 |
-
git+https://github.com/huggingface/transformers@test_composition
|
|
|
1 |
+
transformers
|
2 |
huggingface_hub
|
|
tool_config.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
{
|
|
|
2 |
"description": "This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. It takes the name of the category (such as text-classification, depth-estimation, etc), and returns the name of the checkpoint alongside its 30-day download numbers.",
|
3 |
"name": "model-download-counter",
|
4 |
"tool_class": "model_downloads.HFModelDownloadsTool"
|
|
|
5 |
}
|
|
|
1 |
{
|
2 |
+
"h_f_model_downloads": {
|
3 |
"description": "This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. It takes the name of the category (such as text-classification, depth-estimation, etc), and returns the name of the checkpoint alongside its 30-day download numbers.",
|
4 |
"name": "model-download-counter",
|
5 |
"tool_class": "model_downloads.HFModelDownloadsTool"
|
6 |
+
}
|
7 |
}
|