Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,23 +53,43 @@ def predict_image(img):
|
|
| 53 |
|
| 54 |
# 5. Build and launch the Web App!
|
| 55 |
description_text = """
|
| 56 |
-
|
|
|
|
|
|
|
| 57 |
This model analyzes microscopic pixel noise to determine if an image is real or AI-generated.
|
| 58 |
|
|
|
|
|
|
|
| 59 |
### Limitations for best results:
|
| 60 |
-
|
| 61 |
-
* **
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
"""
|
| 64 |
|
|
|
|
|
|
|
| 65 |
# Inside your interface:
|
|
|
|
| 66 |
interface = gr.Interface(
|
|
|
|
| 67 |
fn=predict_image,
|
|
|
|
| 68 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
|
|
|
| 69 |
outputs=gr.Label(num_top_classes=2, label="Prediction"),
|
|
|
|
| 70 |
title="PixelSleuth: AI Image Detector",
|
|
|
|
| 71 |
description=description_text,
|
|
|
|
| 72 |
flagging_mode="never"
|
|
|
|
| 73 |
)
|
| 74 |
|
| 75 |
interface.launch()
|
|
|
|
| 53 |
|
| 54 |
# 5. Build and launch the Web App!
|
| 55 |
description_text = """
|
| 56 |
+
|
| 57 |
+
### How it works:
|
| 58 |
+
|
| 59 |
This model analyzes microscopic pixel noise to determine if an image is real or AI-generated.
|
| 60 |
|
| 61 |
+
|
| 62 |
+
|
| 63 |
### Limitations for best results:
|
| 64 |
+
|
| 65 |
+
* **Resolution Sweet Spot:** Works flawlessly on standard AI resolutions and mid-sized images (from **512x512 up to around 1000x1500 pixels**, like 640x832 or 880x1320).
|
| 66 |
+
|
| 67 |
+
* **The 4K Danger Zone:** Ultra-high-resolution (like **3840x2160 / 4K**) images will cause the model to fail. Because the model's 'magnifying glass' is strictly fixed to a 224x224 pixel crop, it ends up looking through a pinhole at less than 0.6% of a 4K image, causing it to lose context and guess randomly.
|
| 68 |
+
|
| 69 |
+
* **Centered Subjects:** The model strictly scans the dead-center of the image. If the AI artifacts or mistakes (like extra fingers or warped backgrounds) are on the far edges, the model won't see them!
|
| 70 |
+
|
| 71 |
+
* **No Screenshots:** Heavy compression (like taking a screenshot or downloading from messaging apps) destroys the microscopic forensic evidence. Please upload the raw, original files.
|
| 72 |
+
|
| 73 |
"""
|
| 74 |
|
| 75 |
+
|
| 76 |
+
|
| 77 |
# Inside your interface:
|
| 78 |
+
|
| 79 |
interface = gr.Interface(
|
| 80 |
+
|
| 81 |
fn=predict_image,
|
| 82 |
+
|
| 83 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
| 84 |
+
|
| 85 |
outputs=gr.Label(num_top_classes=2, label="Prediction"),
|
| 86 |
+
|
| 87 |
title="PixelSleuth: AI Image Detector",
|
| 88 |
+
|
| 89 |
description=description_text,
|
| 90 |
+
|
| 91 |
flagging_mode="never"
|
| 92 |
+
|
| 93 |
)
|
| 94 |
|
| 95 |
interface.launch()
|