LPX
commited on
Commit
ยท
39fbd8c
1
Parent(s):
322ab55
๐ style(app): standardize image processing and UI elements
Browse files- specify the general outputs as forensics images instead of ELA images to describe the results more accurately
- rename markdow section to include an accordin section for model notes following similar standards in the rest of the application
app.py
CHANGED
@@ -238,15 +238,16 @@ def predict_image_with_html(img, confidence_threshold, augment_methods, rotate_d
|
|
238 |
|
239 |
# Generate ELA images with different presets
|
240 |
ela_img_1 = ELA(img_pil, scale=100, alpha=0.66)
|
241 |
-
ela_img_2 = ELA(img_pil, scale=
|
242 |
-
ela_img_3 = ELA(img_pil, scale=50, alpha=0.5)
|
243 |
|
244 |
-
|
245 |
|
246 |
html_content = generate_results_html(results)
|
247 |
-
return img_pil,
|
248 |
|
249 |
with gr.Blocks() as iface:
|
|
|
|
|
250 |
with gr.Tab("AI Image Detection"):
|
251 |
gr.Markdown("# AI Generated Image / Deepfake Detection Models Evaluation")
|
252 |
|
@@ -262,15 +263,13 @@ with gr.Blocks() as iface:
|
|
262 |
inputs = [image_input, confidence_slider, augment_checkboxgroup, rotate_slider, noise_slider, sharpen_slider]
|
263 |
predict_button = gr.Button("Predict")
|
264 |
image_output = gr.Image(label="Processed Image", visible=True)
|
265 |
-
|
266 |
|
267 |
|
268 |
with gr.Column(scale=2):
|
269 |
-
with gr.Accordion("Project OpenSight - Model Evaluations & Playground", open=False, elem_id="project_accordion"):
|
270 |
-
gr.Markdown("## OpenSight is a SOTA gen. image detection model, in pre-release prep.\n\nThis HF Space is a temporary home for us and the public to evaluate the shortcomings of current open source models.\n\n<-- Feel free to play around by starting with an image as we prepare our formal announcement.")
|
271 |
# Custom HTML component to display results in 5 columns
|
272 |
results_html = gr.HTML(label="Model Predictions")
|
273 |
-
outputs = [image_output,
|
274 |
|
275 |
# Show/hide rotate slider based on selected augmentation method
|
276 |
augment_checkboxgroup.change(lambda methods: gr.update(visible="rotate" in methods), inputs=[augment_checkboxgroup], outputs=[rotate_slider])
|
|
|
238 |
|
239 |
# Generate ELA images with different presets
|
240 |
ela_img_1 = ELA(img_pil, scale=100, alpha=0.66)
|
241 |
+
ela_img_2 = ELA(img_pil, scale=50, alpha=0.5)
|
|
|
242 |
|
243 |
+
forensics_images = [ela_img_1, ela_img_2, gradient_image, minmax_image]
|
244 |
|
245 |
html_content = generate_results_html(results)
|
246 |
+
return img_pil, forensics_images, html_content
|
247 |
|
248 |
with gr.Blocks() as iface:
|
249 |
+
with gr.Accordion("Project OpenSight - Model Evaluations & Playground", open=False, elem_id="project_accordion"):
|
250 |
+
gr.Markdown("## OpenSight is a SOTA gen. image detection model, in pre-release prep.\n\nThis HF Space is a temporary home for us and the public to evaluate the shortcomings of current open source models.\n\n<-- Feel free to play around by starting with an image as we prepare our formal announcement.")
|
251 |
with gr.Tab("AI Image Detection"):
|
252 |
gr.Markdown("# AI Generated Image / Deepfake Detection Models Evaluation")
|
253 |
|
|
|
263 |
inputs = [image_input, confidence_slider, augment_checkboxgroup, rotate_slider, noise_slider, sharpen_slider]
|
264 |
predict_button = gr.Button("Predict")
|
265 |
image_output = gr.Image(label="Processed Image", visible=True)
|
266 |
+
forensics_gallery = gr.Gallery(label="Post Processed Images", visible=True)
|
267 |
|
268 |
|
269 |
with gr.Column(scale=2):
|
|
|
|
|
270 |
# Custom HTML component to display results in 5 columns
|
271 |
results_html = gr.HTML(label="Model Predictions")
|
272 |
+
outputs = [image_output, forensics_gallery, results_html]
|
273 |
|
274 |
# Show/hide rotate slider based on selected augmentation method
|
275 |
augment_checkboxgroup.change(lambda methods: gr.update(visible="rotate" in methods), inputs=[augment_checkboxgroup], outputs=[rotate_slider])
|