Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,13 +9,16 @@ def model_explorer(search,limit=100,task='text-generation'):
|
|
9 |
if not search:
|
10 |
search=None
|
11 |
out_box=[]
|
|
|
12 |
filt = ModelFilter(task="text-generation")
|
13 |
|
14 |
this = api.list_models(search=search,limit=limit,filter=filt,cardData=True)
|
15 |
-
|
16 |
for i,mod in enumerate(this):
|
|
|
17 |
if mod.gated=='manual':
|
18 |
out_box.append(mod)
|
|
|
19 |
'''
|
20 |
print(dir(mod))
|
21 |
print(mod.id)
|
@@ -24,7 +27,8 @@ def model_explorer(search,limit=100,task='text-generation'):
|
|
24 |
print(mod.pipeline_tag)
|
25 |
out = mod.id
|
26 |
'''
|
27 |
-
|
|
|
28 |
|
29 |
def tasks_json():
|
30 |
|
@@ -88,6 +92,7 @@ with gr.Blocks() as app:
|
|
88 |
search=gr.Textbox()
|
89 |
limit=gr.Slider(minimum=0,maximum=10000,value=100)
|
90 |
btn=gr.Button()
|
|
|
91 |
models_json=gr.JSON()
|
92 |
-
btn.click(model_explorer,[search,limit],models_json)
|
93 |
app.launch()
|
|
|
9 |
if not search:
|
10 |
search=None
|
11 |
out_box=[]
|
12 |
+
name_box=[]
|
13 |
filt = ModelFilter(task="text-generation")
|
14 |
|
15 |
this = api.list_models(search=search,limit=limit,filter=filt,cardData=True)
|
16 |
+
cnt=0
|
17 |
for i,mod in enumerate(this):
|
18 |
+
cnt+=1
|
19 |
if mod.gated=='manual':
|
20 |
out_box.append(mod)
|
21 |
+
name_box.append(mod.id)
|
22 |
'''
|
23 |
print(dir(mod))
|
24 |
print(mod.id)
|
|
|
27 |
print(mod.pipeline_tag)
|
28 |
out = mod.id
|
29 |
'''
|
30 |
+
print(cnt)
|
31 |
+
return out_box,name_box
|
32 |
|
33 |
def tasks_json():
|
34 |
|
|
|
92 |
search=gr.Textbox()
|
93 |
limit=gr.Slider(minimum=0,maximum=10000,value=100)
|
94 |
btn=gr.Button()
|
95 |
+
names_json=gr.JSON()
|
96 |
models_json=gr.JSON()
|
97 |
+
btn.click(model_explorer,[search,limit],[models_json,names_json])
|
98 |
app.launch()
|