Omnibus commited on
Commit
75bac5c
1 Parent(s): c1d30cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -35,10 +35,13 @@ def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
35
  API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config={config}&split={split}&offset={offset}&length={length}"
36
  response = requests.get(API_URL2)
37
  dictionary=response.json()
38
- print (len(dictionary))
 
 
39
  for key in dictionary:
 
40
  print (key)
41
- return dictionary
42
 
43
  def find_fn(lvl_1,lvl_2,fetch_url,config="TEST",split="test",offset=0,length=10):
44
  #print(out_json['rows'])
@@ -64,16 +67,14 @@ def find_fn(lvl_1,lvl_2,fetch_url,config="TEST",split="test",offset=0,length=10)
64
  return img_list
65
 
66
 
67
- def upd_drop(inp1,fetch_url,config="TEST",split="test",offset=0,length=10):
68
 
69
  #def upd_drop(inp1,inp2,inp3,inp4,inp5,fetch_url,config="TEST",split="test",offset=0,length=10):
70
  out_json=query2(fetch_url,config,split,offset=10,length=20)
71
-
72
- for ea in out_json[inp1]:
73
- out = [inp1]
74
-
75
- img_list.append(out_json[ea])
76
- return gr.update(choices=[c for c in img_list])
77
 
78
  with gr.Blocks() as app:
79
  with gr.Row():
@@ -101,7 +102,7 @@ with gr.Blocks() as app:
101
 
102
 
103
  lvl_1.change(upd_drop,[lvl_1,data_set_url,config_set,split_set],lvl_2)
104
- view_data.click(query2,[data_set_url,config_set,split_set],[out_find])
105
 
106
 
107
 
 
35
  API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config={config}&split={split}&offset={offset}&length={length}"
36
  response = requests.get(API_URL2)
37
  dictionary=response.json()
38
+ #print (len(dictionary))
39
+ lvl_1=[]
40
+
41
  for key in dictionary:
42
+ lvl_1.append(key)
43
  print (key)
44
+ return dictionary,gr.update(choices=[l for l in lvl_1])
45
 
46
  def find_fn(lvl_1,lvl_2,fetch_url,config="TEST",split="test",offset=0,length=10):
47
  #print(out_json['rows'])
 
67
  return img_list
68
 
69
 
70
+ def upd_drop(lvl_1,fetch_url,config="TEST",split="test",offset=0,length=10):
71
 
72
  #def upd_drop(inp1,inp2,inp3,inp4,inp5,fetch_url,config="TEST",split="test",offset=0,length=10):
73
  out_json=query2(fetch_url,config,split,offset=10,length=20)
74
+ lvl_2=[]
75
+ for ea in out_json[lvl_1]:
76
+ lvl_2.append(out_json[lvl_1][ea])
77
+ return gr.update(choices=[l for l in lvl_2])
 
 
78
 
79
  with gr.Blocks() as app:
80
  with gr.Row():
 
102
 
103
 
104
  lvl_1.change(upd_drop,[lvl_1,data_set_url,config_set,split_set],lvl_2)
105
+ view_data.click(query2,[data_set_url,config_set,split_set],[out_find,lvl_1])
106
 
107
 
108