A newer version of the Gradio SDK is available:
6.2.0
metadata
title: AI Image Detector
emoji: π
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: false
license: mit
AI Image Detector
Detect whether an image is AI-generated or a real photograph using deep learning.
Model Architecture
- Base Model: MobileNetV2 (pretrained on ImageNet)
- Transfer Learning: Custom classification head with:
- Global Average Pooling
- Batch Normalization
- Dense layer (256 units) with L2 regularization
- Dropout (0.7)
- Sigmoid output for binary classification
Training Data
The model was trained on a combined dataset of ~128,000 images:
- CIFAKE Dataset: 100,000 images (50k real, 50k AI-generated)
- Tiny GenImage Dataset: 28,000 additional images from various AI generators including:
- Midjourney
- Stable Diffusion
- BigGAN
- ADM
- GLIDE
- VQDM
- Wukong
Usage
Upload any image to the interface, and the model will predict whether it's:
- Real Image: A genuine photograph
- AI-Generated: Created by an AI model
Files
app.py- Main Gradio applicationrequirements.txt- Python dependenciestransfer_model.keras- Trained model weights
License
MIT License
Acknowledgments
- CIFAKE Dataset: https://www.kaggle.com/datasets/birdy654/cifake-real-and-ai-generated-synthetic-images
- Tiny GenImage Dataset: https://www.kaggle.com/datasets/yangsangtai/tiny-genimage