Vision Transformer • FastAPI • Celery • Redis • React • Docker
A full-stack, production-ready DeepFake image detection system powered by a Vision Transformer (ViT) model. The application supports asynchronous inference, real-time frontend polling, and fully dockerized deployment.
- 🔍 Vision Transformer (ViT) based DeepFake detection
- ⚡ FastAPI backend with async request handling
- 🧵 Celery + Redis for background inference
- 🌐 React (Vite) frontend
- 🐳 Fully Dockerized (Backend, Worker, Redis, Frontend)
- 📡 Async API (
/predict→/result/{task_id}) - 🔐 Proper CORS & Docker networking
- 📦 Model persistence using Docker volumes
Frontend (React)
|
| HTTP
v
FastAPI Backend
|
| Async Task
v
Celery Worker
|
| Inference
v
Vision Transformer Model
|
v
Redis (Broker & Results)
POST /predictRequest
multipart/form-data- Field:
file
Response
{
"task_id": "abc123"
}GET /result/{task_id}Processing
{ "status": "processing" }Success
{
"status": "done",
"prediction": {
"label": "Real",
"confidence": 0.99
}
}Failure
{ "status": "failed" }- Docker
- Docker Compose
docker-compose up --build| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend | http://localhost:8000 |
| Redis | redis://localhost:6379 |
- ❌
localhostdoes NOT work between containers - ✅ Containers communicate via service names
Frontend uses:
VITE_API_URL=http://backend:8000Backend allows frontend access:
allow_origins=["http://localhost:3000"]- Model files are NOT committed to GitHub
- Loaded at startup or from Docker volume
volumes:
- model-data:/app/content/final-vit-model- Prevents blocking API requests
- Handles heavy ML inference
- Enables scalable async processing
- Perfect for production ML systems
Backend
- FastAPI
- Celery
- Redis
- PyTorch / Transformers
Frontend
- React
- Vite
- Tailwind
DevOps
- Docker
- Docker Compose
Can be deployed on:
- AWS (EC2 / ECS)
- Google Cloud (GCE / Cloud Run)
- Azure (VM / Containers)
Next steps:
- Cloud deployment
- CI/CD with GitHub Actions
Muhammad Daniyal Ijaz AI / ML Engineer FastAPI • Vision Transformers • Docker • Cloud
If you find this project useful:
- ⭐ Star the repository
- 🍴 Fork it
- 🚀 Deploy it