Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,12 +52,23 @@ def predict_image(img):
|
|
| 52 |
return {classes[i]: float(probs[i]) for i in range(2)}
|
| 53 |
|
| 54 |
# 5. Build and launch the Web App!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
interface = gr.Interface(
|
| 56 |
fn=predict_image,
|
| 57 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
| 58 |
outputs=gr.Label(num_top_classes=2, label="Prediction"),
|
| 59 |
-
title="PixelSleuth: AI Image Detector
|
| 60 |
-
description=
|
| 61 |
flagging_mode="never"
|
| 62 |
)
|
| 63 |
|
|
|
|
| 52 |
return {classes[i]: float(probs[i]) for i in range(2)}
|
| 53 |
|
| 54 |
# 5. Build and launch the Web App!
|
| 55 |
+
description_text = """
|
| 56 |
+
### How it works:
|
| 57 |
+
This model analyzes microscopic pixel noise to determine if an image is real or AI-generated.
|
| 58 |
+
|
| 59 |
+
### Limitations for best results:
|
| 60 |
+
* **Resolution Sweet Spot:** Works best on smaller images (around **256x256 to 512x512 pixels**). Ultra-high resolution (1080p or 4K) images will fail because the model's 'magnifying glass' is only 224x224 pixels, meaning it gets lost looking at a tiny fraction of the photo!
|
| 61 |
+
* **Centered Subjects:** The model strictly scans the dead-center of the image. If the AI mistakes are on the edges, it won't see them!
|
| 62 |
+
* **No Screenshots:** Heavy compression (like taking a screenshot or downloading from social media) destroys the forensic evidence. Please upload raw files.
|
| 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 |
|