--- title: Detecting AI Generated Images & Model Attribution emoji: 🖼️ colorFrom: indigo colorTo: blue sdk: streamlit sdk_version: 1.39.0 app_file: streamlit_app.py pinned: false --- # Two-Stage AI Image Detection (HF Space) This Space hosts a Streamlit app that performs: 1. Binary classification: real vs fake. 2. 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 `streamlit_app.py` with your own. ## Running Locally ```bash streamlit run streamlit_app.py ``` 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_DEVICE` in `streamlit_app.py`. - Large model weights aren't stored in-repo; they're pulled via repo IDs to stay under Space storage limits.