Spaces:
Sleeping
Sleeping
show generator type only for AI-generated images
Browse files
app.py
CHANGED
|
@@ -62,16 +62,19 @@ def analyze_image(image):
|
|
| 62 |
result_text += f"📌 **Note:** Model performs best on Stable Diffusion, StyleGAN, and DDPM images. "
|
| 63 |
result_text += f"Performance drops on unseen generators (DALL-E, MidJourney).\n\n"
|
| 64 |
|
| 65 |
-
# Generator type section —
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
result_text +=
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
# Metadata section
|
| 74 |
-
result_text += f"
|
| 75 |
result_text += f"- Format: {metadata['format']}\n"
|
| 76 |
result_text += f"- Dimensions: {metadata['dimensions']}\n"
|
| 77 |
result_text += f"- File Size: {metadata['file_size_kb']} KB\n"
|
|
|
|
| 62 |
result_text += f"📌 **Note:** Model performs best on Stable Diffusion, StyleGAN, and DDPM images. "
|
| 63 |
result_text += f"Performance drops on unseen generators (DALL-E, MidJourney).\n\n"
|
| 64 |
|
| 65 |
+
# Generator type section — only shown when image is predicted AI-Generated
|
| 66 |
+
# No point showing generator type if image is classified as real
|
| 67 |
+
if label == "AI-Generated":
|
| 68 |
+
gen_type = generator_result["generator_type"]
|
| 69 |
+
gen_conf = generator_result["confidence"]
|
| 70 |
+
result_text += f"**Generator Type:** {gen_type} ({gen_conf}%)\n\n"
|
| 71 |
+
result_text += "**Class Probabilities:**\n"
|
| 72 |
+
for cls, prob in generator_result["class_probabilities"].items():
|
| 73 |
+
result_text += f"- {cls}: {prob}%\n"
|
| 74 |
+
result_text += "\n"
|
| 75 |
|
| 76 |
# Metadata section
|
| 77 |
+
result_text += f"**Metadata:**\n"
|
| 78 |
result_text += f"- Format: {metadata['format']}\n"
|
| 79 |
result_text += f"- Dimensions: {metadata['dimensions']}\n"
|
| 80 |
result_text += f"- File Size: {metadata['file_size_kb']} KB\n"
|