pikto commited on
Commit
e8fdc19
·
1 Parent(s): a0390c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -23
app.py CHANGED
@@ -125,13 +125,13 @@ with gr.Blocks(theme='pikto/theme@>=0.0.1,<0.0.3') as pan:
125
 
126
  model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2,])
127
 
128
- #with gr.Tab("Flip Image"):
129
  #Using Gradio Demos as API - This is Hot!
130
  #get_next10_images(response_dict=response_dict, row_count=9)
131
  #position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
132
 
133
  #Defining the Blocks layout
134
- with gr.Blocks(css = """#img_search img {width: 100%; height: 100%; object-fit: cover;}""") as demo:
135
  gr.HTML(value="top of page", elem_id="top",visible=False)
136
  gr.HTML("""<div style="text-align: center; max-width: 700px; margin: 0 auto;">
137
  <div
@@ -140,32 +140,24 @@ with gr.Blocks(theme='pikto/theme@>=0.0.1,<0.0.3') as pan:
140
  align-items: center;
141
  gap: 0.8rem;
142
  font-size: 1.75rem;
143
- "
144
- >
145
- <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
146
  Using Gradio Demos as API - 2 </h1><br></div>
147
- <div><h4 style="font-weight: 500; margin-bottom: 7px; margin-top: 5px;">
148
  Stream <a href="https://github.com/playgroundai/liked_images" target="_blank">PlaygroundAI Images</a> ina beautiful grid</h4><br>
149
- </div>""")
150
- with gr.Accordion(label="Details about the working:", open=False, elem_id='accordion'):
151
- gr.HTML("""
152
- <p style="margin-bottom: 10px; font-size: 90%"><br>
153
- ▶️Do you see the "view api" link located in the footer of this application?
154
- By clicking on this link, a page will open which provides documentation on the REST API that developers can use to query the Interface function / Block events.<br>
155
- ▶️In this demo, I am making such an API request to the <a href="https://huggingface.co/spaces/ysharma/Playground_AI_Exploration" target="_blank">Playground_AI_Exploration</a> Space.<br>
156
- ▶️I am exposing an API endpoint of this Gradio app as well. This can easily be done by one line of code, just set the api_name parameter of the event listener.
157
- </p></div>""")
158
-
159
- with gr.Column(): #(elem_id = "col-container"):
160
- b1 = gr.Button("Load More Images").style(full_width=False)
161
- df = gr.Textbox(visible=False,elem_id='dataframe', value=response_dict)
162
- row_count = gr.Number(visible=False, value=19 )
163
- img_search = gr.HTML(label = 'Images from PlaygroundAI dataset', elem_id="img_search",
164
  value=initial_imgs ) #initial[:-1] )
165
 
166
- gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/Stream_PlaygroundAI_Images?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>
167
  </p></div>''')
168
- b1.click(get_next10_images, [df, row_count], [df, row_count, img_search], api_name = "load_playgroundai_images" )
169
 
170
 
171
  with gr.Tab("Diffuser"):
 
125
 
126
  model_name1.change(set_model, inputs=model_name1, outputs=[output1, output2,])
127
 
128
+ with gr.Tab("Flip Image"):
129
  #Using Gradio Demos as API - This is Hot!
130
  #get_next10_images(response_dict=response_dict, row_count=9)
131
  #position: fixed; top: 0; left: 0; width: 100%; background-color: #fff; padding: 20px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
132
 
133
  #Defining the Blocks layout
134
+ # with gr.Blocks(css = """#img_search img {width: 100%; height: 100%; object-fit: cover;}""") as demo:
135
  gr.HTML(value="top of page", elem_id="top",visible=False)
136
  gr.HTML("""<div style="text-align: center; max-width: 700px; margin: 0 auto;">
137
  <div
 
140
  align-items: center;
141
  gap: 0.8rem;
142
  font-size: 1.75rem;
143
+ "
144
+ >
145
+ <h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
146
  Using Gradio Demos as API - 2 </h1><br></div>
147
+ <div><h4 style="font-weight: 500; margin-bottom: 7px; margin-top: 5px;">
148
  Stream <a href="https://github.com/playgroundai/liked_images" target="_blank">PlaygroundAI Images</a> ina beautiful grid</h4><br>
149
+ </div>""")
150
+
151
+ with gr.Column(): #(elem_id = "col-container"):
152
+ b1 = gr.Button("Load More Images").style(full_width=False)
153
+ df = gr.Textbox(visible=False,elem_id='dataframe', value=response_dict)
154
+ row_count = gr.Number(visible=False, value=19 )
155
+ img_search = gr.HTML(label = 'Images from PlaygroundAI dataset', elem_id="img_search",
 
 
 
 
 
 
 
 
156
  value=initial_imgs ) #initial[:-1] )
157
 
158
+ gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/Stream_PlaygroundAI_Images?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>
159
  </p></div>''')
160
+ b1.click(get_next10_images, [df, row_count], [df, row_count, img_search], api_name = "load_playgroundai_images" )
161
 
162
 
163
  with gr.Tab("Diffuser"):