Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
|
|
37 |
dictionary=response.json()
|
38 |
return dictionary
|
39 |
|
40 |
-
def find_fn(
|
41 |
#print(out_json['rows'])
|
42 |
#print (inp)
|
43 |
img_list=[]
|
@@ -45,10 +45,12 @@ def find_fn(inp,fetch_url,config="TEST",split="test",offset=0,length=10):
|
|
45 |
|
46 |
inp=inp.strip("[]")
|
47 |
print(inp)
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
52 |
return img_list
|
53 |
with gr.Blocks() as app:
|
54 |
with gr.Row():
|
@@ -60,7 +62,9 @@ with gr.Blocks() as app:
|
|
60 |
#config_drop = gr.Dropdown(label="Config/Split", choices=[])
|
61 |
view_data=gr.Button(label="View")
|
62 |
with gr.Row():
|
63 |
-
|
|
|
|
|
64 |
find_btn=gr.Button("Search")
|
65 |
with gr.Row():
|
66 |
with gr.Column(scale=1):
|
@@ -70,6 +74,6 @@ with gr.Blocks() as app:
|
|
70 |
out_gal = gr.Gallery()
|
71 |
|
72 |
view_data.click(query2,[data_set_url,config_set,split_set],[out_find])
|
73 |
-
find_btn.click(find_fn,[
|
74 |
fetch_btn.click(query1,data_set_url,out_json)
|
75 |
app.launch()
|
|
|
37 |
dictionary=response.json()
|
38 |
return dictionary
|
39 |
|
40 |
+
def find_fn(lvl_1,lvl_2,fetch_url,config="TEST",split="test",offset=0,length=10):
|
41 |
#print(out_json['rows'])
|
42 |
#print (inp)
|
43 |
img_list=[]
|
|
|
45 |
|
46 |
inp=inp.strip("[]")
|
47 |
print(inp)
|
48 |
+
if lvl_2 != "":
|
49 |
+
for ea in out_json[f"{lvl_1}"]:
|
50 |
+
#img_ea = ea['row']['image']['src']
|
51 |
+
img_list.append(ea[f"{lvl_2}"])
|
52 |
+
if lvl_2 == "":
|
53 |
+
img_list.append(out_json[lvl_1])
|
54 |
return img_list
|
55 |
with gr.Blocks() as app:
|
56 |
with gr.Row():
|
|
|
62 |
#config_drop = gr.Dropdown(label="Config/Split", choices=[])
|
63 |
view_data=gr.Button(label="View")
|
64 |
with gr.Row():
|
65 |
+
lvl_1=gr.Textbox("in:")
|
66 |
+
lvl_2=gr.Textbox("find every:")
|
67 |
+
|
68 |
find_btn=gr.Button("Search")
|
69 |
with gr.Row():
|
70 |
with gr.Column(scale=1):
|
|
|
74 |
out_gal = gr.Gallery()
|
75 |
|
76 |
view_data.click(query2,[data_set_url,config_set,split_set],[out_find])
|
77 |
+
find_btn.click(find_fn,[lvl_1,lvl_2,data_set_url,config_set,split_set],[out_find])
|
78 |
fetch_btn.click(query1,data_set_url,out_json)
|
79 |
app.launch()
|