Zhu-FaceOnLive commited on
Commit
6c86cd2
Β·
verified Β·
1 Parent(s): 2ea7049

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -6
app.py CHANGED
@@ -166,6 +166,15 @@ caption.caption {
166
  div#component-16 {
167
  max-height: 63.39px;
168
  }
 
 
 
 
 
 
 
 
 
169
  """
170
 
171
  js = """
@@ -207,8 +216,15 @@ head = """
207
  </script>
208
  """
209
 
210
- output = gr.Gallery(label="Found Images", columns=[4], object_fit="contain", height="auto")
211
- with gr.Blocks(css=custom_css, head=head) as demo:
 
 
 
 
 
 
 
212
  gr.Markdown(
213
  """
214
  # Free Face Search Online
@@ -217,25 +233,31 @@ with gr.Blocks(css=custom_css, head=head) as demo:
217
  """
218
  )
219
  with gr.Row():
220
- with gr.Column(scale=1):
221
  image = gr.Image(type='filepath', height=480)
222
  token = gr.Textbox(placeholder="(Optional) Get Premium Token Below.", label="Premium Token")
223
- gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb' target='_blank'>Get Premium Token: Deep Search Including Social Media & Full URL Reveal</a>")
224
- gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676d7e7597f8b3b699f84820' target='_blank'>Protect Your Privacy – Start Your Takedown Now</a>")
225
  search_face_button = gr.Button("Search Face")
226
  gr.Examples(['examples/1.jpg', 'examples/2.jpg'], inputs=image, cache_examples=True, cache_mode='lazy', fn=search_face, outputs=[output])
227
 
228
- with gr.Column(scale=2):
229
  gr.Markdown("> ### **⚠️ Reminder:** Export images before refreshing the page by clicking the 'Export Images' button.")
230
  output.render()
231
  with gr.Row():
232
  export_button = gr.Button("Export Images")
233
  export_file = gr.File(label="Download")
 
 
 
234
 
235
 
 
236
  search_face_button.click(search_face, inputs=[image, token], outputs=[output], api_name=False)
237
  export_button.click(export_images, inputs=[output], outputs=export_file, api_name=False)
238
 
 
 
239
  gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
240
  html = gr.HTML()
241
  demo.load(None, inputs=None, outputs=html, js=js)
 
166
  div#component-16 {
167
  max-height: 63.39px;
168
  }
169
+
170
+ .svelte-snayfm {
171
+ height: auto;
172
+ }
173
+
174
+ .icon.svelte-snayfm {
175
+ width: 48px;
176
+ height: 48px;
177
+ }
178
  """
179
 
180
  js = """
 
216
  </script>
217
  """
218
 
219
+ output = gr.Gallery(label="Found Images", columns=[4], object_fit="contain", height="auto", interactive=False)
220
+
221
+ def init_ui():
222
+ return gr.update(visible=True), gr.update(visible=False)
223
+
224
+ def search_ui():
225
+ return gr.update(visible=False), gr.update(visible=True)
226
+
227
+ with gr.Blocks(css=custom_css, head=head, delete_cache=(3600, 3600)) as demo:
228
  gr.Markdown(
229
  """
230
  # Free Face Search Online
 
233
  """
234
  )
235
  with gr.Row():
236
+ with gr.Column(scale=1) as col1:
237
  image = gr.Image(type='filepath', height=480)
238
  token = gr.Textbox(placeholder="(Optional) Get Premium Token Below.", label="Premium Token")
239
+ gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb' target='_blank' style='font-size: 16px;'>Get Premium Token: Deep Search Including Social Media & Full URL Reveal</a>")
240
+ gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676d7e7597f8b3b699f84820' target='_blank' style='font-size: 16px;'>Protect Your Privacy – Start Your Takedown Now</a>")
241
  search_face_button = gr.Button("Search Face")
242
  gr.Examples(['examples/1.jpg', 'examples/2.jpg'], inputs=image, cache_examples=True, cache_mode='lazy', fn=search_face, outputs=[output])
243
 
244
+ with gr.Column(scale=2, visible=False) as col2:
245
  gr.Markdown("> ### **⚠️ Reminder:** Export images before refreshing the page by clicking the 'Export Images' button.")
246
  output.render()
247
  with gr.Row():
248
  export_button = gr.Button("Export Images")
249
  export_file = gr.File(label="Download")
250
+ gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676c15b1971244a587ca07cb' target='_blank' style='font-size: 16px;'>Get Premium Token: Deep Search Including Social Media & Full URL Reveal</a>")
251
+ gr.HTML("<a href='https://faceonlive.pocketsflow.com/checkout?productId=676d7e7597f8b3b699f84820' target='_blank' style='font-size: 16px;'>Protect Your Privacy – Start Your Takedown Now</a>")
252
+ new_search_button = gr.Button("πŸš€ Try New Search")
253
 
254
 
255
+ search_face_button.click(search_ui, inputs=[], outputs=[col1, col2], api_name=False)
256
  search_face_button.click(search_face, inputs=[image, token], outputs=[output], api_name=False)
257
  export_button.click(export_images, inputs=[output], outputs=export_file, api_name=False)
258
 
259
+ new_search_button.click(init_ui, inputs=[], outputs=[col1, col2], api_name=False)
260
+
261
  gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
262
  html = gr.HTML()
263
  demo.load(None, inputs=None, outputs=html, js=js)