Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,16 +15,18 @@ def query1(fetch_url):
|
|
15 |
response = requests.get(API_URL1)
|
16 |
json_obj=response.json()
|
17 |
|
18 |
-
|
|
|
19 |
for obj in json_obj:
|
20 |
print (obj)
|
21 |
-
out_config = obj[
|
22 |
-
out_split = obj[
|
23 |
print (out_config)
|
24 |
print (out_split)
|
25 |
-
|
|
|
26 |
#df = pd.DataFrame.from_dict(json_obj)
|
27 |
-
return json_obj
|
28 |
|
29 |
|
30 |
def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
|
@@ -109,8 +111,8 @@ with gr.Blocks() as app:
|
|
109 |
data_set_url=gr.Textbox(label="Dataset (repo/name)")
|
110 |
fetch_btn=gr.Button()
|
111 |
with gr.Row():
|
112 |
-
config_set=gr.
|
113 |
-
split_set=gr.
|
114 |
#config_drop = gr.Dropdown(label="Config/Split", choices=[])
|
115 |
view_data=gr.Button(label="View")
|
116 |
with gr.Row():
|
@@ -137,5 +139,5 @@ with gr.Blocks() as app:
|
|
137 |
|
138 |
|
139 |
#find_btn.click(find_fn,[lvl_1,lvl_2,data_set_url,config_set,split_set],[out_find])
|
140 |
-
fetch_btn.click(query1,data_set_url,out_json)
|
141 |
app.launch()
|
|
|
15 |
response = requests.get(API_URL1)
|
16 |
json_obj=response.json()
|
17 |
|
18 |
+
config_box = []
|
19 |
+
split_box = []
|
20 |
for obj in json_obj:
|
21 |
print (obj)
|
22 |
+
out_config = obj['config']
|
23 |
+
out_split = obj['split']
|
24 |
print (out_config)
|
25 |
print (out_split)
|
26 |
+
config_box.append(obj['config'])
|
27 |
+
split_box.append(obj['split'])
|
28 |
#df = pd.DataFrame.from_dict(json_obj)
|
29 |
+
return json_obj,gr.update(choices=[c for c in config_box],gr.update(choices=[s for s in split_box]))
|
30 |
|
31 |
|
32 |
def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
|
|
|
111 |
data_set_url=gr.Textbox(label="Dataset (repo/name)")
|
112 |
fetch_btn=gr.Button()
|
113 |
with gr.Row():
|
114 |
+
config_set=gr.Dropdown(label="Config")
|
115 |
+
split_set=gr.Dropdown(label="Split")
|
116 |
#config_drop = gr.Dropdown(label="Config/Split", choices=[])
|
117 |
view_data=gr.Button(label="View")
|
118 |
with gr.Row():
|
|
|
139 |
|
140 |
|
141 |
#find_btn.click(find_fn,[lvl_1,lvl_2,data_set_url,config_set,split_set],[out_find])
|
142 |
+
fetch_btn.click(query1,data_set_url,[out_json,config_set,split_set])
|
143 |
app.launch()
|