Spaces:
Running
on
Zero
Running
on
Zero
image sizing
Browse files
app.py
CHANGED
@@ -274,34 +274,55 @@ def advance_blur(input_image):
|
|
274 |
|
275 |
if __name__ == "__main__":
|
276 |
# Start your Gradio app
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
gr.Markdown(
|
280 |
-
"
|
281 |
-
|
282 |
-
'Advance Blur uses a sophisticated technique called "Vance Blurring"'
|
283 |
-
" to anonymize images of people. This process also removes identifiable"
|
284 |
-
" metadata. Uploaded images and data are permanently deleted after processing."
|
285 |
-
"\n\n"
|
286 |
-
"Advance Blur works best when subjects face the camera. Any similarity to"
|
287 |
-
" persons, living or dead, is purely coincidental, comedic, karmic justice,"
|
288 |
-
" and/or parody."
|
289 |
-
"\n\n"
|
290 |
-
"_No sofas, couches, chaises, or other living-room furniture have been harmed in "
|
291 |
-
" the production of this application._"
|
292 |
-
)
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
generate_btn = gr.Button("Submit")
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
if __name__ == "__main__":
|
276 |
# Start your Gradio app
|
277 |
+
css_code = """
|
278 |
+
.gradio-container {
|
279 |
+
max-width: 480px; /* keep UI narrow for mobile-friendliness */
|
280 |
+
margin: 0 auto; /* center the content */
|
281 |
+
}
|
282 |
+
|
283 |
+
#fixed-image-size {
|
284 |
+
width: 300px !important; /* fix the width of image */
|
285 |
+
height: 300px !important; /* fix the height of image */
|
286 |
+
object-fit: cover; /* makes the image fill area without stretching */
|
287 |
+
}
|
288 |
+
"""
|
289 |
+
with gr.Blocks(css=css_code, theme=gr.themes.Basic()) as app:
|
290 |
gr.Markdown(
|
291 |
+
"""
|
292 |
+
# Advance Blur
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
+
**Advance Blur** uses a sophisticated technique called "Vance Blurring" to anonymize images of people.
|
295 |
+
This process also removes identifiable metadata.
|
296 |
+
Uploaded images and data are permanently deleted after processing.
|
|
|
297 |
|
298 |
+
_No sofas, couches, chaises, or other living-room furniture were harmed in the production of this application._
|
299 |
+
""",
|
300 |
+
)
|
301 |
|
302 |
+
with gr.Column():
|
303 |
+
input_image = gr.Image(
|
304 |
+
type="filepath",
|
305 |
+
label="Upload Your Image",
|
306 |
+
elem_id="fixed-image-size",
|
307 |
+
tool=None,
|
308 |
+
show_label=True,
|
309 |
+
)
|
310 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
311 |
+
|
312 |
+
output_image = gr.Image(
|
313 |
+
label="Blurred Image",
|
314 |
+
elem_id="fixed-image-size",
|
315 |
+
tool=None,
|
316 |
+
show_label=True,
|
317 |
+
)
|
318 |
+
|
319 |
+
# Trigger your blur function
|
320 |
+
submit_btn.click(fn=advance_blur, inputs=[input_image], outputs=[output_image])
|
321 |
+
|
322 |
+
# Option to "Start Over" (clear inputs/outputs)
|
323 |
+
start_over_btn = gr.Button("Start Over", variant="secondary")
|
324 |
+
start_over_btn.click(
|
325 |
+
fn=lambda: (None, None), inputs=[], outputs=[input_image, output_image]
|
326 |
+
)
|
327 |
+
|
328 |
+
app.launch(share=True)
|