SnapSure is a local deepfake detection app with:
frontend/: Next.js frontend on port3000backend/: Flask API on port8000models/: inference code for the ensemble detectordocker/: backend and frontend Dockerfilesk8s/: Kubernetes manifests for MinikubeJenkinsfile: Jenkins pipeline for local Docker and Minikube deployment
The backend loads two Hugging Face image-classification models:
Wvolf/ViT_Deepfake_Detectiondima806/deepfake_vs_real_image_detection
It averages the fake probability from both models and returns:
overall_labeloverall_confidencefake_scorenum_faces
Face detection uses MTCNN. Face count is returned in the response, but face detection is not used to make the REAL/FAKE decision.
Returns:
{ "status": "ok", "model": "ensemble" }If DEMO_MODE=true, it returns:
{ "status": "ok", "model": "demo" }Send multipart/form-data with a file field.
Supported file types:
.jpg.jpeg.png.webp
Example success response:
{
"overall_label": "REAL",
"overall_confidence": 0.8765,
"fake_score": 0.1235,
"num_faces": 1,
"faces": []
}From the repo root:
docker compose up --buildApp URLs:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:8000
Stop it with:
docker compose downThe backend container stores Hugging Face and Torch cache in a named Docker volume:
backend-model-cache
This means:
- the models are downloaded on the first run
- later restarts reuse the cache
- the model weights are not baked into the backend image
Backend:
cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
cd ..
set PYTHONPATH=.
python -m backend.appFrontend:
cd frontend
npm install
npm run devBackend environment values are read from:
backend/.envbackend/.env.docker
Main backend variables:
MODEL_DEVICE=cpuDEMO_MODE=false
The Docker and Kubernetes setups also set:
HF_HOMETORCH_HOMEXDG_CACHE_HOME
These keep downloaded model files in a persistent cache path.
The backend image now uses CPU-only PyTorch wheels and excludes local virtualenv folders from the build context. That keeps the backend image much smaller than the earlier CUDA-heavy build.
For Minikube deployment:
For Jenkins setup:
- see JENKINS-SETUP.md