A simple web application that detects if an image is real or AI-generated. No training required - works immediately! Features a modern Svelte frontend and FastAPI backend.
The baseline detector uses statistical feature analysis:
No training required - works immediately on any image!
INSTALL.bat
1. Install Python dependencies:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
2. Install frontend dependencies:
cd frontend-svelte
npm install
cd ..
RUN_ALL.bat
Terminal 1 - Backend:
venv\Scripts\activate
python app.py
Terminal 2 - Frontend:
cd frontend-svelte
npm run dev
Access:
No training needed - the baseline detector works immediately!
from baseline_detector import predict
# Predict on an image (no training needed!)
result = predict("path/to/image.jpg")
print(f"Label: {result['label']}")
print(f"Confidence: {result['confidence']:.2%}")
print(f"Reasons: {result['reasons']}")
{
"label": "real" or "ai",
"confidence": 0.0-1.0,
"score": float,
"features": {...},
"reasons": ["reason1", "reason2", "reason3"]
}
Backend:
Frontend:
See requirements.txt for complete Python dependencies.
For better accuracy, consider implementing neural network approaches (EfficientNet, Vision Transformer).
This implementation follows the mathematical pipeline described in the reference image and is provided as-is for research and educational purposes.