Omnibus commited on
Commit
3c99043
1 Parent(s): c1e08f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -12,16 +12,14 @@ def query1():
12
  response = requests.get(API_URL1)
13
  #response = requests.get(API_URL1, headers=headers)
14
  return response.json()
15
- data = query1()
16
- print (data)
17
 
18
 
19
- def query2(fetch_url,offset=0,length=10):
20
  if fetch_url=="":
21
  fetch_url = "nlphuji/flickr30k"
22
  #offset=0
23
  #length=10
24
- API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config=TEST&split=test&offset={offset}&length={length}"
25
  response = requests.get(API_URL2)
26
  dictionary=response.json()
27
  return dictionary
@@ -50,5 +48,5 @@ with gr.Blocks() as app:
50
  out_find = gr.JSON()
51
 
52
  find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
53
- fetch_btn.click(query2,data_set_url,out_json)
54
  app.launch()
 
12
  response = requests.get(API_URL1)
13
  #response = requests.get(API_URL1, headers=headers)
14
  return response.json()
 
 
15
 
16
 
17
+ def query2(fetch_url,config="TEST",split="test",offset=0,length=10):
18
  if fetch_url=="":
19
  fetch_url = "nlphuji/flickr30k"
20
  #offset=0
21
  #length=10
22
+ API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config={config}&split={split}&offset={offset}&length={length}"
23
  response = requests.get(API_URL2)
24
  dictionary=response.json()
25
  return dictionary
 
48
  out_find = gr.JSON()
49
 
50
  find_btn.click(find_fn,[find_string,out_json],[out_find,out_gal])
51
+ fetch_btn.click(query1,data_set_url,out_json)
52
  app.launch()