metadata
title: Detecting AI Generated Images & Model Attribution
emoji: 🖼️
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
Two-Stage AI Image Detection (HF Space)
This Space hosts a Gradio app that performs:
- Binary classification: real vs fake.
- Origin classification (if fake): platform/source.
Models
Instead of bundling large weight files (Space storage limit), the app downloads models at runtime from Hugging Face Hub using repo IDs:
Binary (real vs fake): KomaAl/level_1_binary_model
Multiclass (origin): KomaAl/level_2_multiclass_model
If you fork this Space, replace these IDs in gradio_two_stage_app.py with your own.
Running Locally
python app.py
Open the Gradio link printed in the terminal. First run may take longer while models download.
Override Rule (If Implemented Externally)
If you later add a custom override for a particular label logic (e.g., Imagen confidence rule), integrate it inside CascadeClassifier.predict after computing multiclass probs.
Requirements
See requirements.txt for pinned versions suitable for CPU inference.
Notes
- Mixed precision (AMP) auto-enables on CUDA if available.
- To force CPU, modify
DEFAULT_DEVICEingradio_two_stage_app.pyor passdevice='cpu'when constructing the cascade. - Large model weights aren't stored in-repo; they're pulled via repo IDs to stay under Space storage limits.