ali-faraz-py/deepfake-detector
ali-faraz-py/deepfake-detector has 34 GitHub stars and 1 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-09 16:39 UTC. Last push 2026-08-17.
AI-powered deepfake detector that classifies uploaded face images and videos as Real or Fake with confidence scores. Full-stack app built with PyTorch (EfficientNet-B0), FastAPI, and Next.js — trained on 100k+ images and deployed with Vercel + Render.
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original🔍 Deepfake Detector
An AI-powered web app that analyzes uploaded face images and videos to classify them as Real or Deepfake, with a confidence score. Built as a full-stack project covering model training, backend API development, and frontend deployment.
Live app: deepfake-detector-olive.vercel.app Backend API: deepfake-detector-api-amqf.onrender.com
Demo

What it does
- Upload a face image or video
- The model classifies it as Real or Fake
- Returns a confidence percentage, shown with a visual confidence bar
- For videos, samples multiple frames and averages predictions across them
- Drag-and-drop upload, live preview, and a history of recent checks
- Try-it-now sample buttons (one real photo, one AI-generated photo) for visitors without their own test files
- File type and size validation, with toast notifications for errors
- Dark mode toggle
- A visible disclaimer noting the model's known generalization limits (see below)
Tech Stack
Frontend
- Next.js (React)
- Tailwind CSS
- Deployed on Vercel
Backend
- FastAPI (Python)
- PyTorch + EfficientNet-B0
- OpenCV (video frame extraction)
- Deployed on Render
Model Training
- Trained on Google Colab (free GPU)
- Dataset: 140k Real and Fake Faces (Kaggle, by xhlulu)
- 100,000 training images / 20,000 validation images
- 3 epochs, ~99.7% training accuracy
How it works
- The frontend sends the uploaded file to the FastAPI backend
- If it's an image, it's resized, normalized, and passed through EfficientNet-B0
- If it's a video, OpenCV extracts ~5-10 sampled frames, each is classified individually, and the results are averaged into one final prediction
- The model returns a label (
Real/Fake) and a confidence score as JSON - The frontend displays the result with a color-coded card
Known Limitations
- Generalization: The model was trained on StyleGAN-generated faces (the dataset's specific fake-image style). It performs very well (~99.7%) on that distribution, but may not generalize reliably to images generated by other AI tools (e.g. diffusion models like Midjourney or DALL·E), since those leave different visual artifacts than the ones the model learned to detect. This is a well-documented, open challenge in deepfake detection research generally — not unique to this project.
- Cold starts: The backend is hosted on Render's free tier, which spins down after inactivity. The first request after idle time may take 30-60 seconds to respond.
- Video processing: Limited to a small number of sampled frames (not every frame) to stay within free-tier memory limits.
Running Locally
Backend
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload
Frontend
cd frontend
npm install
npm run dev
Create a .env.local file in frontend/ with:
NEXT_PUBLIC_API_URL=http://127.0.0.1:8000
Project Structure
deepfake-detector/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI routes
│ │ ├── model.py # Model loading + inference
│ │ └── preprocessing.py # Video frame extraction
│ ├── models/
│ │ └── deepfake_model.pth
│ └── requirements.txt
└── frontend/
└── src/app/
└── page.js # Upload UI + result display
Author
Built by Ali Faraz as a portfolio project exploring the intersection of computer vision, cybersecurity, and full-stack deployment.
Explore related projects
tensorflow/tensorflow
An Open Source Machine Learning Framework for Everyone
201,427 starshuggingface/transformers
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
168,711 starsAUTOMATIC1111/stable-diffusion-webui
Stable Diffusion web UI
165,274 starsComfy-Org/ComfyUI
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
146,024 stars