Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,9 @@ def query1(fetch_url):
|
|
12 |
fetch_url = "nlphuji/flickr30k"
|
13 |
API_URL1 = f"https://datasets-server.huggingface.co/splits?dataset={fetch_url}"
|
14 |
response = requests.get(API_URL1)
|
15 |
-
|
|
|
|
|
16 |
return response.json()
|
17 |
|
18 |
|
@@ -38,17 +40,23 @@ def find_fn(inp,out_json):
|
|
38 |
return img_list,img_list
|
39 |
with gr.Blocks() as app:
|
40 |
with gr.Row():
|
41 |
-
data_set_url=gr.Textbox()
|
|
|
42 |
fetch_btn=gr.Button()
|
|
|
|
|
|
|
|
|
43 |
with gr.Row():
|
44 |
find_string=gr.Textbox()
|
45 |
find_btn=gr.Button("Search")
|
46 |
with gr.Row():
|
47 |
out_json = gr.JSON()
|
48 |
with gr.Column():
|
49 |
-
out_gal = gr.Gallery()
|
50 |
out_find = gr.JSON()
|
|
|
51 |
|
|
|
52 |
find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
|
53 |
fetch_btn.click(query1,data_set_url,out_json)
|
54 |
app.launch()
|
|
|
12 |
fetch_url = "nlphuji/flickr30k"
|
13 |
API_URL1 = f"https://datasets-server.huggingface.co/splits?dataset={fetch_url}"
|
14 |
response = requests.get(API_URL1)
|
15 |
+
json_obj=response.json()
|
16 |
+
for obj in json_obj:
|
17 |
+
print (obj)
|
18 |
return response.json()
|
19 |
|
20 |
|
|
|
40 |
return img_list,img_list
|
41 |
with gr.Blocks() as app:
|
42 |
with gr.Row():
|
43 |
+
data_set_url=gr.Textbox(label="Dataset (repo/name)")
|
44 |
+
|
45 |
fetch_btn=gr.Button()
|
46 |
+
with gr.Row():
|
47 |
+
config_set=gr.Textbox(label="Config")
|
48 |
+
split_set=gr.Textbox(label="Split")
|
49 |
+
view_data=gr.Button(label="View")
|
50 |
with gr.Row():
|
51 |
find_string=gr.Textbox()
|
52 |
find_btn=gr.Button("Search")
|
53 |
with gr.Row():
|
54 |
out_json = gr.JSON()
|
55 |
with gr.Column():
|
|
|
56 |
out_find = gr.JSON()
|
57 |
+
out_gal = gr.Gallery()
|
58 |
|
59 |
+
view_data.click(query2,[find_string,config_set,split_set],[out_find])
|
60 |
find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
|
61 |
fetch_btn.click(query1,data_set_url,out_json)
|
62 |
app.launch()
|