Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,19 +2,22 @@ import gradio as gr
|
|
2 |
import json
|
3 |
from huggingface_hub import HfApi, ModelFilter, list_models
|
4 |
api = HfApi()
|
5 |
-
def model_explorer():
|
6 |
# List all models
|
7 |
filt = ModelFilter(task="text-generation")
|
8 |
|
9 |
-
this = api.list_models(limit=
|
|
|
10 |
for i,mod in enumerate(this):
|
|
|
11 |
print(dir(mod))
|
12 |
print(mod.id)
|
13 |
print(mod.downloads)
|
14 |
print(mod.likes)
|
15 |
print(mod.pipeline_tag)
|
16 |
out = mod.id
|
17 |
-
|
|
|
18 |
|
19 |
model_explorer()
|
20 |
def tasks_json():
|
@@ -75,7 +78,8 @@ def fix_json():
|
|
75 |
if line.strip():
|
76 |
print (line)
|
77 |
with gr.Blocks() as app:
|
|
|
78 |
btn=gr.Button()
|
79 |
models_json=gr.JSON()
|
80 |
-
btn.click(model_explorer,
|
81 |
app.launch()
|
|
|
2 |
import json
|
3 |
from huggingface_hub import HfApi, ModelFilter, list_models
|
4 |
api = HfApi()
|
5 |
+
def model_explorer(limit=100,task='text-generation'):
|
6 |
# List all models
|
7 |
filt = ModelFilter(task="text-generation")
|
8 |
|
9 |
+
this = api.list_models(limit=limit,filter=filt,cardData=True)
|
10 |
+
'''
|
11 |
for i,mod in enumerate(this):
|
12 |
+
|
13 |
print(dir(mod))
|
14 |
print(mod.id)
|
15 |
print(mod.downloads)
|
16 |
print(mod.likes)
|
17 |
print(mod.pipeline_tag)
|
18 |
out = mod.id
|
19 |
+
'''
|
20 |
+
return this
|
21 |
|
22 |
model_explorer()
|
23 |
def tasks_json():
|
|
|
78 |
if line.strip():
|
79 |
print (line)
|
80 |
with gr.Blocks() as app:
|
81 |
+
limit=gr.Slider(minimum=1,maximum=100,value=100)
|
82 |
btn=gr.Button()
|
83 |
models_json=gr.JSON()
|
84 |
+
btn.click(model_explorer,[limit],models_json)
|
85 |
app.launch()
|