ysharma HF staff commited on
Commit
e5fbffb
1 Parent(s): 6b4a66c

removed a bug thats loading images twice

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -35,11 +35,12 @@ def get_next10_images(response_dict, row_count):
35
  "data": [response_dict, row_count ] #len(initial)-1
36
  }).json()
37
  row_count+=10
 
38
  #print("(2)",type(response))
39
  #print("(3)",type(response['data'][0]))
40
  next_set = [resp[0][:-1] for resp in response_dict["data"]]
41
  next_set_images = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); ">\n' + "\n".join(next_set[:-1])
42
- return response['data'][0], row_count, next_set_images
43
 
44
  #get_next10_images(response_dict=response_dict, row_count=9)
45
  #position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
@@ -59,7 +60,7 @@ with gr.Blocks(css = """#img_search img {width: 100%; height: 100%; object-fit:
59
  <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
60
  Using Gradio Demos as API - 2 </h1><br></div>
61
  <div><h4 style="font-weight: 500; margin-bottom: 7px; margin-top: 5px;">
62
- Stream <a href="" target="_blank">PlaygroundAI Images</a> ina beautiful grid</h4><br>
63
  </div>""")
64
  with gr.Accordion(label="Details about the working:", open=False, elem_id='accordion'):
65
  gr.HTML("""
 
35
  "data": [response_dict, row_count ] #len(initial)-1
36
  }).json()
37
  row_count+=10
38
+ response_dict = response['data'][0]
39
  #print("(2)",type(response))
40
  #print("(3)",type(response['data'][0]))
41
  next_set = [resp[0][:-1] for resp in response_dict["data"]]
42
  next_set_images = '<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); grid-gap: 0; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); ">\n' + "\n".join(next_set[:-1])
43
+ return response_dict, row_count, next_set_images #response['data'][0]
44
 
45
  #get_next10_images(response_dict=response_dict, row_count=9)
46
  #position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
 
60
  <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
61
  Using Gradio Demos as API - 2 </h1><br></div>
62
  <div><h4 style="font-weight: 500; margin-bottom: 7px; margin-top: 5px;">
63
+ Stream <a href="https://github.com/playgroundai/liked_images" target="_blank">PlaygroundAI Images</a> ina beautiful grid</h4><br>
64
  </div>""")
65
  with gr.Accordion(label="Details about the working:", open=False, elem_id='accordion'):
66
  gr.HTML("""