model2 commited on
Commit
1b66097
·
1 Parent(s): 8bda490
Files changed (1) hide show
  1. app.py +45 -54
app.py CHANGED
@@ -1,6 +1,3 @@
1
- # TODO: UI/UX: Better display on mobile so folks don't miss the final output
2
- # TODO: Upgrade gradio
3
-
4
  import logging
5
  import os
6
  import sys
@@ -145,9 +142,6 @@ def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
145
 
146
  Returns:
147
  Any: The value at the given index.
148
-
149
- Raises:
150
- IndexError: If the index is out of bounds for the object and the object is not a mapping.
151
  """
152
  try:
153
  return obj[index]
@@ -273,51 +267,50 @@ def advance_blur(input_image):
273
 
274
 
275
  if __name__ == "__main__":
276
- # Start your Gradio app
277
  css_code = """
278
- #fixed-image-size {
279
- max-width: 600px !important; /* fix the width of image */
280
- max-height: 600px !important; /* fix the height of image */
281
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
- /* Use smaller max sizes on mobile */
284
- @media (max-width: 768px) {
285
  #fixed-image-size {
286
- max-width: 320px !important;
287
- max-height: 320px !important;
288
  }
289
- }
290
-
291
- #example-images {
292
- display: flex;
293
- max-width: 320px;
294
- align-items: left;
295
- align: left;
296
- justify-content: left;
297
- margin-left: 0;
298
- margin-right: 0;
299
- padding-left: 0;
300
- padding-right: 0;
301
- overflow-x: auto;
302
- gap: 20px;
303
- }
304
-
305
- .example-image {
306
- display: flex;
307
- flex-direction: column;
308
- align-items: start;
309
- margin-right: 20px;
310
- max-width: 140px !important; /* fix the width of image */
311
- max-height: 140px !important; /* fix the height of image */
312
- }
313
- """
314
- with gr.Blocks(css=css_code, theme=gr.themes.Base()) as app:
315
- gr.Markdown( """
316
- # 🥸 Advance Blur
317
 
318
- Anonymize your group photos using Vance Blurring!
319
- """)
320
 
 
321
  with gr.Row(elem_id="example-images"):
322
  with gr.Column(elem_classes=["example-image"]):
323
  gr.Image(
@@ -337,18 +330,16 @@ if __name__ == "__main__":
337
  with gr.Accordion("More info", open=False):
338
  gr.Markdown(
339
  """
340
- **Advance Blur** uses a sophisticated technique called "Vance Blurring" to anonymize images of people!
341
 
342
  **Features:**
343
- - **Replaces up to 100 faces:** Anonymize your images using the face of the ideal American male!
344
- - **Removes identifying metadata:** Ensures your privacy by removing all identifying EXIF, IPTC, and XMP metadata!
345
- - **Safe and secure:** All uploaded images and data are permanently deleted after processing!
346
 
347
  **Disclaimer:**
348
- This application is for entertainment purposes only.
349
- Any resemblance to actual persons, living or dead, is purely coincidental, comedic, karmic, and/or parody.
350
-
351
- _No sofas, couches, chaises, or other living-room furniture were harmed in the production of Advance Blur._
352
  """
353
  )
354
 
@@ -371,6 +362,6 @@ if __name__ == "__main__":
371
 
372
  # Trigger your blur function
373
  submit_btn.click(fn=advance_blur, inputs=[input_image], outputs=[output_image])
374
- # Add a Gradio Examples section to let users see a sample run
375
 
 
376
  app.launch(share=True)
 
 
 
 
1
  import logging
2
  import os
3
  import sys
 
142
 
143
  Returns:
144
  Any: The value at the given index.
 
 
 
145
  """
146
  try:
147
  return obj[index]
 
267
 
268
 
269
  if __name__ == "__main__":
270
+ # Updated, more flexible CSS
271
  css_code = """
272
+ /* Container for side-by-side example images */
273
+ #example-images {
274
+ display: flex;
275
+ gap: 20px;
276
+ flex-wrap: wrap; /* Wrap if not enough space */
277
+ justify-content: center; /* Center them in their container */
278
+ margin-bottom: 1rem;
279
+ }
280
+
281
+ /* Each example image column */
282
+ .example-image img {
283
+ width: 100%;
284
+ height: auto;
285
+ max-width: 300px; /* You can adjust this for larger previews */
286
+ }
287
+
288
+ /* If you REALLY want them side-by-side on mobile,
289
+ let them scroll horizontally instead of wrapping. */
290
+ @media (max-width: 768px) {
291
+ #example-images {
292
+ overflow-x: auto;
293
+ flex-wrap: nowrap; /* Force side-by-side with horizontal scroll */
294
+ }
295
+ }
296
 
297
+ /* Fix the main input/output image sizes for uniform display */
 
298
  #fixed-image-size {
299
+ max-width: 600px !important;
300
+ max-height: 600px !important;
301
  }
302
+ @media (max-width: 768px) {
303
+ #fixed-image-size {
304
+ max-width: 320px !important;
305
+ max-height: 320px !important;
306
+ }
307
+ }
308
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
 
310
+ with gr.Blocks(css=css_code, theme=gr.themes.Base()) as app:
311
+ gr.Markdown("# 🥸 Advance Blur")
312
 
313
+ # Side-by-side examples
314
  with gr.Row(elem_id="example-images"):
315
  with gr.Column(elem_classes=["example-image"]):
316
  gr.Image(
 
330
  with gr.Accordion("More info", open=False):
331
  gr.Markdown(
332
  """
333
+ **Advance Blur** uses a sophisticated technique called "Vance Blurring" to anonymize images!
334
 
335
  **Features:**
336
+ - **Replaces up to 100 faces** with the face of the ideal American male!
337
+ - **Removes identifying metadata** (EXIF, IPTC, and XMP).
338
+ - **Safe and secure:** All uploaded images are deleted after processing.
339
 
340
  **Disclaimer:**
341
+ This is for entertainment only. Any resemblance to actual persons is purely coincidental, comedic,
342
+ karmic, or parody.
 
 
343
  """
344
  )
345
 
 
362
 
363
  # Trigger your blur function
364
  submit_btn.click(fn=advance_blur, inputs=[input_image], outputs=[output_image])
 
365
 
366
+ # Launch the app
367
  app.launch(share=True)