test: ela params
Browse files
app.py
CHANGED
|
@@ -273,16 +273,17 @@ def predict_image_with_html(img, confidence_threshold, augment_methods, rotate_d
|
|
| 273 |
img_pil = img
|
| 274 |
img_pil, results = predict_image(img_pil, confidence_threshold)
|
| 275 |
img_np = np.array(img_pil) # Convert PIL Image to NumPy array
|
|
|
|
| 276 |
|
| 277 |
gradient_image = gradient_processing(img_np) # Added gradient processing
|
| 278 |
minmax_image = minmax_preprocess(img_np) # Added MinMax processing
|
| 279 |
|
| 280 |
# First pass - standard analysis
|
| 281 |
-
ela1 = ELA(
|
| 282 |
|
| 283 |
# Second pass - enhanced visibility
|
| 284 |
-
ela2 = ELA(
|
| 285 |
-
ela3 = ELA(
|
| 286 |
|
| 287 |
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, minmax_image]
|
| 288 |
|
|
@@ -320,7 +321,7 @@ with gr.Blocks(css="#post-gallery { overflow: hidden !important;} .grid-wrap{ ov
|
|
| 320 |
with gr.Column(scale=2):
|
| 321 |
# Custom HTML component to display results in 5 columns
|
| 322 |
results_html = gr.HTML(label="Model Predictions")
|
| 323 |
-
forensics_gallery = gr.Gallery(label="Post Processed Images", visible=True, columns=[
|
| 324 |
|
| 325 |
outputs = [image_output, forensics_gallery, results_html]
|
| 326 |
|
|
|
|
| 273 |
img_pil = img
|
| 274 |
img_pil, results = predict_image(img_pil, confidence_threshold)
|
| 275 |
img_np = np.array(img_pil) # Convert PIL Image to NumPy array
|
| 276 |
+
img_np_og = np.array(img) # Convert PIL Image to NumPy array
|
| 277 |
|
| 278 |
gradient_image = gradient_processing(img_np) # Added gradient processing
|
| 279 |
minmax_image = minmax_preprocess(img_np) # Added MinMax processing
|
| 280 |
|
| 281 |
# First pass - standard analysis
|
| 282 |
+
ela1 = ELA(img_np_og, quality=75, scale=50, contrast=20, linear=False, grayscale=True)
|
| 283 |
|
| 284 |
# Second pass - enhanced visibility
|
| 285 |
+
ela2 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=True)
|
| 286 |
+
ela3 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=False)
|
| 287 |
|
| 288 |
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, minmax_image]
|
| 289 |
|
|
|
|
| 321 |
with gr.Column(scale=2):
|
| 322 |
# Custom HTML component to display results in 5 columns
|
| 323 |
results_html = gr.HTML(label="Model Predictions")
|
| 324 |
+
forensics_gallery = gr.Gallery(label="Post Processed Images", visible=True, columns=[4], rows=[2], container=False, height="auto", object_fit="contain", elem_id="post-gallery")
|
| 325 |
|
| 326 |
outputs = [image_output, forensics_gallery, results_html]
|
| 327 |
|