LPX
commited on
Commit
·
31239ef
1
Parent(s):
73ffe6a
refactor: simplify ELA function name and clean up unused augmentations in Gradio interface
Browse files- app_mcp.py +2 -7
- utils/ela.py +1 -1
app_mcp.py
CHANGED
@@ -15,7 +15,7 @@ import logging
|
|
15 |
from utils.utils import softmax, augment_image, convert_pil_to_bytes
|
16 |
from utils.gradient import gradient_processing
|
17 |
from utils.minmax import minmax_process
|
18 |
-
from utils.ela import
|
19 |
from utils.wavelet import wavelet_blocking_noise_estimation
|
20 |
from utils.bitplane import bit_plane_extractor
|
21 |
from utils.hf_logger import log_inference_data
|
@@ -524,12 +524,7 @@ with gr.Blocks(css="#post-gallery { overflow: hidden !important;} .grid-wrap{ ov
|
|
524 |
consensus_md = gr.Markdown(label="Consensus", value="")
|
525 |
|
526 |
outputs = [image_output, forensics_gallery, results_table, debug_json, consensus_md]
|
527 |
-
|
528 |
-
# Show/hide rotate slider based on selected augmentation method
|
529 |
-
augment_checkboxgroup.change(lambda methods: gr.update(visible="rotate" in methods), inputs=[augment_checkboxgroup], outputs=[rotate_slider])
|
530 |
-
augment_checkboxgroup.change(lambda methods: gr.update(visible="add_noise" in methods), inputs=[augment_checkboxgroup], outputs=[noise_slider])
|
531 |
-
augment_checkboxgroup.change(lambda methods: gr.update(visible="sharpen" in methods), inputs=[augment_checkboxgroup], outputs=[sharpen_slider])
|
532 |
-
|
533 |
predict_button.click(
|
534 |
fn=predict_with_ensemble,
|
535 |
inputs=inputs,
|
|
|
15 |
from utils.utils import softmax, augment_image, convert_pil_to_bytes
|
16 |
from utils.gradient import gradient_processing
|
17 |
from utils.minmax import minmax_process
|
18 |
+
from utils.ela import ELA
|
19 |
from utils.wavelet import wavelet_blocking_noise_estimation
|
20 |
from utils.bitplane import bit_plane_extractor
|
21 |
from utils.hf_logger import log_inference_data
|
|
|
524 |
consensus_md = gr.Markdown(label="Consensus", value="")
|
525 |
|
526 |
outputs = [image_output, forensics_gallery, results_table, debug_json, consensus_md]
|
527 |
+
|
|
|
|
|
|
|
|
|
|
|
528 |
predict_button.click(
|
529 |
fn=predict_with_ensemble,
|
530 |
inputs=inputs,
|
utils/ela.py
CHANGED
@@ -24,7 +24,7 @@ def elapsed_time(start):
|
|
24 |
"""Calculate elapsed time since start."""
|
25 |
return f"{time() - start:.3f}s"
|
26 |
|
27 |
-
def
|
28 |
"""
|
29 |
Perform Error Level Analysis on an image.
|
30 |
|
|
|
24 |
"""Calculate elapsed time since start."""
|
25 |
return f"{time() - start:.3f}s"
|
26 |
|
27 |
+
def ELA(img, quality=75, scale=50, contrast=20, linear=False, grayscale=False):
|
28 |
"""
|
29 |
Perform Error Level Analysis on an image.
|
30 |
|