Spaces:
Sleeping
Sleeping
Sync from GitHub via hub-sync
Browse files
README.md
CHANGED
|
@@ -1,74 +1,42 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
- Eye-region sequence extraction from videos (MediaPipe + OpenCV)
|
| 7 |
-
- LRCN-style temporal model with ViT/CNN backbone
|
| 8 |
-
- Adversarial training hooks (FGSM/PGD)
|
| 9 |
-
- Evaluation suite (Accuracy, Precision, Recall, F1, AUC)
|
| 10 |
-
- Ablation runner and explainability utilities
|
| 11 |
|
| 12 |
-
|
| 13 |
-
- `configs/` experiment and model configs
|
| 14 |
-
- `src/data/` dataset preparation and preprocessing
|
| 15 |
-
- `src/models/` backbones and model architecture
|
| 16 |
-
- `src/train/` training and adversarial routines
|
| 17 |
-
- `src/eval/` evaluation and ablation utilities
|
| 18 |
-
- `src/viz/` attention map visualization helpers
|
| 19 |
-
- `scripts/` local/cloud convenience runners
|
| 20 |
|
| 21 |
-
##
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
PYENV_VERSION=3.11.11 python -m venv .venv311
|
| 27 |
-
source .venv311/bin/activate
|
| 28 |
-
pip install -r requirements-phase1.txt
|
| 29 |
-
pip install mediapipe==0.10.21 --no-deps
|
| 30 |
-
pip install absl-py attrs flatbuffers "protobuf>=4.25,<5" jax jaxlib matplotlib sounddevice
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
### 2. HuggingFace login (one-time)
|
| 34 |
-
|
| 35 |
-
```bash
|
| 36 |
-
hf auth login
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
### 3. Phase 1 โ Stream dataset and build `.npz` files
|
| 40 |
-
|
| 41 |
-
Uses HuggingFace **streaming** (`load_dataset(..., streaming=True)` + `decode(False)`): one video at a time in RAM, no 17GB zip copied into `data/processed/`. Only `.npz` files are saved locally.
|
| 42 |
|
| 43 |
```bash
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
--out-root data/processed \
|
| 47 |
-
--metadata-csv data/metadata.csv \
|
| 48 |
-
--num-real 200 \
|
| 49 |
-
--num-fake 200
|
| 50 |
```
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
```bash
|
| 55 |
-
NUM_REAL=2 NUM_FAKE=2 bash scripts/run_local.sh
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
### 4. Phase 2 โ Train (after Phase 1 completes)
|
| 59 |
-
|
| 60 |
-
```bash
|
| 61 |
-
pip install torch torchvision timm scikit-learn matplotlib seaborn
|
| 62 |
-
python -m src.train.train --config configs/train/aat_pgd.yaml
|
| 63 |
-
python -m src.eval.evaluate --checkpoint outputs/best.pt --config configs/train/aat_pgd.yaml
|
| 64 |
-
```
|
| 65 |
|
| 66 |
-
|
| 67 |
-
-
|
| 68 |
-
|
|
|
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 73 |
-
-
|
| 74 |
-
- Cloud GPU: full training and ablation sweeps
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Deepfake Detector API
|
| 3 |
+
emoji: ๐
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
| 10 |
+
---
|
| 11 |
|
| 12 |
+
# Deepfake Detector API
|
| 13 |
|
| 14 |
+
FastAPI inference service for the [Enhanced Deepfake Detector](https://github.com/oyingrace/deepfake-detection) (LRCN + ViT, blink-aware temporal modeling).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
> **GitHub project docs:** see [.github/README.md](.github/README.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
## Endpoints
|
| 19 |
|
| 20 |
+
| Method | Path | Description |
|
| 21 |
+
|--------|------|-------------|
|
| 22 |
+
| `GET` | `/health` | Service status and model load state |
|
| 23 |
+
| `POST` | `/predict` | Upload a video (multipart form field `file`) |
|
| 24 |
|
| 25 |
+
## Example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
```bash
|
| 28 |
+
curl https://devqueen-deepfake-server.hf.space/health
|
| 29 |
+
curl -X POST https://devqueen-deepfake-server.hf.space/predict -F "file=@video.mp4"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
```
|
| 31 |
|
| 32 |
+
## Runtime variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
| Variable | Description |
|
| 35 |
+
|----------|-------------|
|
| 36 |
+
| `ALLOWED_ORIGINS` | Comma-separated frontend URLs for CORS (e.g. your Vercel app) |
|
| 37 |
+
| `DEVICE` | `cpu` (default) |
|
| 38 |
|
| 39 |
+
## Deploy notes
|
| 40 |
|
| 41 |
+
- Synced from GitHub via `.github/workflows/sync-to-hf-space.yml`
|
| 42 |
+
- Full setup guide: [huggingface/README.md](huggingface/README.md)
|
|
|