test_scanly / README.md
farouk04's picture
Swap yt-dlp for SaverAPI
f58e53b
|
Raw
History Blame Contribute Delete
2.49 kB

A newer version of the Gradio SDK is available: 6.22.0

Upgrade
metadata
title: Deepfake Detector
emoji: 🎬
colorFrom: red
colorTo: purple
sdk: gradio
app_file: detector.py
pinned: false
hardware: zero-gpu

Deepfake Detector

Detects AI-generated (deepfake) videos using V-JEPA 2.1 ViT-Giant as a frozen video encoder and a trained AttentiveClassifier probe on top.

Paste a public Instagram reel, TikTok, or direct .mp4 URL. The model runs sliding-window inference across the full video and reports per-window fake probabilities alongside a final prediction.

How it works

  1. Video is downloaded via the SaverAPI HTTP API (CPU, no GPU quota used). A pool of up to 10 API keys is rotated automatically with sticky failover.
  2. Frames are decoded and normalized with decord (CPU)
  3. V-JEPA 2.1 encodes clips into patch token sequences (GPU)
  4. AttentiveClassifier cross-attends over all tokens and outputs a fake probability (GPU)
  5. Final score = max probability across all windows (max strategy)

Required Space secrets

Set these in Settings → Repository secrets:

Secret Value
HF_TOKEN Your HuggingFace access token
ENCODER_REPO HF repo ID where vjepa2_1_vitg_384.pt is stored
PROBE_REPO HF repo ID where attentive_probe_optimized.pt is stored
SAVER_API_KEY_1SAVER_API_KEY_10 SaverAPI keys (one secret per key; unset ones are ignored)

ENCODER_REPO and PROBE_REPO can point to the same private repo.

Optional SaverAPI tuning secrets

Secret Default Purpose
SAVER_API_KEY_COOLDOWN_SEC 3600 How long a failing key is skipped before being re-tested
SAVER_API_LOOKUP_TIMEOUT_SEC 15 Timeout for SaverAPI's JSON lookup
SAVER_API_DOWNLOAD_TIMEOUT_SEC 60 Timeout for the streamed byte pull
SAVER_API_MAX_RETRIES_PER_REQUEST 3 How many keys to try before failing a single user request
SAVER_API_MAX_FILESIZE_MB 100 Hard cap on downloaded video size
SAVER_API_STARTUP_PROBE_URL (unset) A known-good video URL; if set, all keys are probed at Space boot
SKIP_STARTUP_PROBE (unset) Set to 1 to skip the boot probe entirely

Files in this Space

File Purpose
detector.py Main Gradio app + ZeroGPU integration + SaverAPI client + key rotator
inference_core.py Model architecture + video windowing (unchanged from training)
requirements.txt Python deps (decord, requests)
packages.txt System dep (ffmpeg)