Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,17 @@ def query1(fetch_url):
|
|
14 |
API_URL1 = f"https://datasets-server.huggingface.co/splits?dataset={fetch_url}"
|
15 |
response = requests.get(API_URL1)
|
16 |
json_obj=response.json()
|
|
|
|
|
17 |
for obj in json_obj:
|
|
|
|
|
18 |
print (obj)
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
|
23 |
def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
|
@@ -45,8 +52,9 @@ with gr.Blocks() as app:
|
|
45 |
data_set_url=gr.Textbox(label="Dataset (repo/name)")
|
46 |
fetch_btn=gr.Button()
|
47 |
with gr.Row():
|
48 |
-
config_set=gr.Textbox(label="Config")
|
49 |
-
split_set=gr.Textbox(label="Split")
|
|
|
50 |
view_data=gr.Button(label="View")
|
51 |
with gr.Row():
|
52 |
find_string=gr.Textbox()
|
@@ -57,7 +65,7 @@ with gr.Blocks() as app:
|
|
57 |
out_find = gr.JSON()
|
58 |
out_gal = gr.Gallery()
|
59 |
|
60 |
-
view_data.click(query2,[data_set_url,
|
61 |
find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
|
62 |
fetch_btn.click(query1,data_set_url,out_json)
|
63 |
app.launch()
|
|
|
14 |
API_URL1 = f"https://datasets-server.huggingface.co/splits?dataset={fetch_url}"
|
15 |
response = requests.get(API_URL1)
|
16 |
json_obj=response.json()
|
17 |
+
|
18 |
+
drop_box = []
|
19 |
for obj in json_obj:
|
20 |
+
out_config = obj["splits"]["config"]
|
21 |
+
out_split = obj["splits"]["split"]
|
22 |
print (obj)
|
23 |
+
print (out_config)
|
24 |
+
print (out_split)
|
25 |
+
drop_box.append(obj["splits"])
|
26 |
+
#df = pd.DataFrame.from_dict(json_obj)
|
27 |
+
return gr.update(choices=[d for d in drop_box])
|
28 |
|
29 |
|
30 |
def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
|
|
|
52 |
data_set_url=gr.Textbox(label="Dataset (repo/name)")
|
53 |
fetch_btn=gr.Button()
|
54 |
with gr.Row():
|
55 |
+
#config_set=gr.Textbox(label="Config")
|
56 |
+
#split_set=gr.Textbox(label="Split")
|
57 |
+
config_drop = gr.Dropdown(label="Config/Split", choices=[])
|
58 |
view_data=gr.Button(label="View")
|
59 |
with gr.Row():
|
60 |
find_string=gr.Textbox()
|
|
|
65 |
out_find = gr.JSON()
|
66 |
out_gal = gr.Gallery()
|
67 |
|
68 |
+
view_data.click(query2,[data_set_url,config],[out_find])
|
69 |
find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
|
70 |
fetch_btn.click(query1,data_set_url,out_json)
|
71 |
app.launch()
|