oof...
Browse files
app.py
CHANGED
@@ -122,7 +122,7 @@ register_model_with_metadata(
|
|
122 |
)
|
123 |
|
124 |
# --- ONNX Quantized Model Example ---
|
125 |
-
ONNX_QUANTIZED_MODEL_PATH = "./models/model_1_quantized.onnx"
|
126 |
|
127 |
def preprocess_onnx_input(image: Image.Image):
|
128 |
# Preprocess image for ONNX model (e.g., for SwinV2, usually 256x256, normalized)
|
@@ -423,11 +423,11 @@ def full_prediction(img, confidence_threshold, rotate_degrees, noise_level, shar
|
|
423 |
gradient_image2 = gradient_processing(img_np_og, intensity=45, equalize=True)
|
424 |
minmax_image = minmax_process(img_np_og)
|
425 |
minmax_image2 = minmax_process(img_np_og, radius=6)
|
426 |
-
bitplane_image = bit_plane_extractor(img_pil)
|
427 |
ela1 = ELA(img_np_og, quality=75, scale=50, contrast=20, linear=False, grayscale=True)
|
428 |
ela2 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=True)
|
429 |
ela3 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=False)
|
430 |
-
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, gradient_image2, minmax_image, minmax_image2
|
431 |
forensic_output_descriptions = [
|
432 |
f"Original augmented image (PIL): {img_pil.width}x{img_pil.height}",
|
433 |
"ELA analysis (Pass 1): Grayscale error map, quality 75.",
|
@@ -437,7 +437,7 @@ def full_prediction(img, confidence_threshold, rotate_degrees, noise_level, shar
|
|
437 |
"Gradient processing: Int=45, Equalize=True",
|
438 |
"MinMax processing: Deviations in local pixel values.",
|
439 |
"MinMax processing (Radius=6): Deviations in local pixel values.",
|
440 |
-
"Bit Plane extractor: Visualization of individual bit planes from different color channels."
|
441 |
]
|
442 |
anomaly_detection_results = anomaly_agent.analyze_forensic_outputs(forensic_output_descriptions)
|
443 |
logger.info(f"Forensic anomaly detection: {anomaly_detection_results['summary']}")
|
@@ -554,7 +554,7 @@ def predict(img):
|
|
554 |
handle_file(img),
|
555 |
api_name="/simple_predict"
|
556 |
)
|
557 |
-
return result
|
558 |
community_forensics_preview = gr.Interface(
|
559 |
fn=predict,
|
560 |
inputs=gr.Image(type="filepath"),
|
|
|
122 |
)
|
123 |
|
124 |
# --- ONNX Quantized Model Example ---
|
125 |
+
ONNX_QUANTIZED_MODEL_PATH = "./models/model_1_quantized.onnx"
|
126 |
|
127 |
def preprocess_onnx_input(image: Image.Image):
|
128 |
# Preprocess image for ONNX model (e.g., for SwinV2, usually 256x256, normalized)
|
|
|
423 |
gradient_image2 = gradient_processing(img_np_og, intensity=45, equalize=True)
|
424 |
minmax_image = minmax_process(img_np_og)
|
425 |
minmax_image2 = minmax_process(img_np_og, radius=6)
|
426 |
+
# bitplane_image = bit_plane_extractor(img_pil)
|
427 |
ela1 = ELA(img_np_og, quality=75, scale=50, contrast=20, linear=False, grayscale=True)
|
428 |
ela2 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=True)
|
429 |
ela3 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=False)
|
430 |
+
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, gradient_image2, minmax_image, minmax_image2]
|
431 |
forensic_output_descriptions = [
|
432 |
f"Original augmented image (PIL): {img_pil.width}x{img_pil.height}",
|
433 |
"ELA analysis (Pass 1): Grayscale error map, quality 75.",
|
|
|
437 |
"Gradient processing: Int=45, Equalize=True",
|
438 |
"MinMax processing: Deviations in local pixel values.",
|
439 |
"MinMax processing (Radius=6): Deviations in local pixel values.",
|
440 |
+
# "Bit Plane extractor: Visualization of individual bit planes from different color channels."
|
441 |
]
|
442 |
anomaly_detection_results = anomaly_agent.analyze_forensic_outputs(forensic_output_descriptions)
|
443 |
logger.info(f"Forensic anomaly detection: {anomaly_detection_results['summary']}")
|
|
|
554 |
handle_file(img),
|
555 |
api_name="/simple_predict"
|
556 |
)
|
557 |
+
return str(result)
|
558 |
community_forensics_preview = gr.Interface(
|
559 |
fn=predict,
|
560 |
inputs=gr.Image(type="filepath"),
|