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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
- Visual deepfake detection (2x ViT ensemble)
|
| 17 |
-
- Audio analysis (AI voice detection)
|
| 18 |
-
- Browser extension support
|
| 19 |
-
- REST API
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
|
| 3 |
+
# π AUTHRIX
|
| 4 |
+
### AI-Powered Deepfake Detection Engine
|
| 5 |
+
|
| 6 |
+
[](https://python.org)
|
| 7 |
+
[](https://fastapi.tiangolo.com)
|
| 8 |
+
[](https://react.dev)
|
| 9 |
+
[](https://huggingface.co)
|
| 10 |
+
[](https://docker.com)
|
| 11 |
+
[](LICENSE)
|
| 12 |
+
|
| 13 |
+
**Authrix** is a full-stack, multi-agent deepfake detection platform that analyzes videos for AI-generated content using a Vision Transformer (ViT) ensemble, temporal consistency analysis, C2PA metadata scanning, and AI audio detection β all wrapped in a sleek cyberpunk-themed dashboard and a Chrome extension.
|
| 14 |
+
|
| 15 |
+
[π Live Demo](https://aarav13-authrix.hf.space) Β· [π§© Chrome Extension](#browser-extension) Β· [π‘ API Reference](#api-reference) Β· [π¬ Pricing](#pricing--tiers)
|
| 16 |
+
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## β¨ Key Features
|
| 22 |
+
|
| 23 |
+
| Feature | Description |
|
| 24 |
+
|---|---|
|
| 25 |
+
| π§ **ViT Ensemble** | 2-model Vision Transformer ensemble (dima806 + prithivMLmods) with float16 batched inference |
|
| 26 |
+
| ποΈ **Temporal Analysis** | Detects AI video patterns: unnatural motion smoothness, temporal flickering, color drift |
|
| 27 |
+
| π **C2PA / Metadata Scan** | Identifies AI generator signatures from Veo3, Sora, Runway, Firefly, Kling, etc. |
|
| 28 |
+
| π **Audio Detection** | Spectral analysis for AI voice synthesis & audio-visual mismatch detection |
|
| 29 |
+
| π **Browser Extension** | Chrome/Edge extension (MV3) that captures tab video stream for real-time analysis |
|
| 30 |
+
| π **URL Analysis** | Paste any YouTube/TikTok/Twitter/Instagram URL β powered by yt-dlp |
|
| 31 |
+
| π **API Key System** | Tiered access control with per-month usage quotas and Stripe billing integration |
|
| 32 |
+
| π³ **Docker + Render** | One-command deployment to Render (or any Docker host / HuggingFace Spaces) |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## ποΈ Architecture
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 40 |
+
β CLIENT LAYER β
|
| 41 |
+
β βββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββ β
|
| 42 |
+
β β React Frontend β β Chrome Extension β β REST API β β
|
| 43 |
+
β β (Vite + TW4) β β (MV3, JS) β β Consumers β β
|
| 44 |
+
β ββββββββββ¬βββββββββ ββββββββββ¬ββββββββββ βββββββ¬βββββββ β
|
| 45 |
+
βββββββββββββΌβββββββββββββββββββ βΌβββββββββββββββββββ βΌβββββββββ
|
| 46 |
+
β β β
|
| 47 |
+
βΌ βΌ βΌ
|
| 48 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 49 |
+
β FastAPI BACKEND β
|
| 50 |
+
β β
|
| 51 |
+
β POST /analyze POST /analyze-url GET /health β
|
| 52 |
+
β β
|
| 53 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 54 |
+
β β DETECTION PIPELINE β β
|
| 55 |
+
β β β β
|
| 56 |
+
β β Agent 0a: Metadata Agent (C2PA / AI tool scan) β β
|
| 57 |
+
β β Agent 0b: Temporal Agent (flicker / motion CV) β β
|
| 58 |
+
β β Agent 1: Frame Extractor (dedup, 40-frame sample) β β
|
| 59 |
+
β β Agent 2: Face Detector (MediaPipe, single ctx) β β
|
| 60 |
+
β β Agent 3: Decision Agent (ViT ensemble, float16) β β
|
| 61 |
+
β β Agent 4: Report Agent (calibrated + audio fused) β β
|
| 62 |
+
β β Agent 5: Audio Agent (librosa spectral + AV sync)β β
|
| 63 |
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 64 |
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### Detection Pipeline
|
| 68 |
+
|
| 69 |
+
1. **Metadata Agent** β Binary-scans the first 512 KB + last 64 KB of the video file for C2PA markers, XMP tags, and known AI-generator signatures (Veo, Sora, Runway, Kling, Fireflyβ¦). If a C2PA block is found, the file is immediately flagged with 98% confidence.
|
| 70 |
+
|
| 71 |
+
2. **Temporal Agent** β Measures pixel-level temporal variance, frame-difference coefficient of variation, high-frequency noise consistency, and color-channel drift across frames. Catches modern AI video generators that produce unnaturally smooth motion.
|
| 72 |
+
|
| 73 |
+
3. **Frame Extractor** β Intelligently samples up to 40 deduplicated frames, skipping near-identical consecutive frames to save inference time.
|
| 74 |
+
|
| 75 |
+
4. **Face Detector** β MediaPipe face detection runs in a **single context** across all frames (avoids repeated model init) and crops each face with 20% padding.
|
| 76 |
+
|
| 77 |
+
5. **Decision Agent (ViT Ensemble)** β All face crops are sent to **both ViT models in a single batched forward pass** (float16). Model 2 is early-exited if Model 1 is already very confident (>88% or <12%). Scores are ensemble-weighted 55/45.
|
| 78 |
+
|
| 79 |
+
6. **Audio Agent** β Extracts audio track via MoviePy/ffmpeg, runs librosa spectral analysis to detect AI voice synthesis, unnatural pitch/tempo regularity, and audio-visual sync mismatches.
|
| 80 |
+
|
| 81 |
+
7. **Report Agent** β Fuses all signals with an adaptive threshold. A C2PA hard match always wins; audio-visual mismatch overrides visual; otherwise, temporal + visual ensemble determines the final verdict with calibrated confidence.
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## ποΈ Project Structure
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
authrix/
|
| 89 |
+
βββ backend/ # FastAPI backend
|
| 90 |
+
β βββ main.py # App entry point, routes, middleware
|
| 91 |
+
β βββ detector.py # Core multi-agent detection engine (all 5 agents)
|
| 92 |
+
β βββ audio_detector.py # Audio analysis agent (librosa + AV sync)
|
| 93 |
+
β βββ auth.py # API key validation, tier limits
|
| 94 |
+
β βββ stripe_integration.py # Stripe billing hooks
|
| 95 |
+
β βββ create_owner_key.py # CLI helper to mint API keys
|
| 96 |
+
β βββ test_temporal.py # Unit tests for temporal analysis
|
| 97 |
+
β βββ requirements.txt # Python dependencies
|
| 98 |
+
β βββ uploads/ # Temp upload directory (auto-cleaned)
|
| 99 |
+
β
|
| 100 |
+
βββ frontend/ # React 19 + Vite 8 + Tailwind 4 dashboard
|
| 101 |
+
β βββ src/
|
| 102 |
+
β β βββ components/ # UI components (Loader, ResultCard, etc.)
|
| 103 |
+
β β βββ main.jsx # App entry
|
| 104 |
+
β βββ index.html
|
| 105 |
+
β βββ package.json
|
| 106 |
+
β βββ vite.config.js
|
| 107 |
+
β
|
| 108 |
+
βββ frontend-vanilla/ # Vanilla HTML/JS fallback frontend
|
| 109 |
+
β βββ index.html
|
| 110 |
+
β βββ pricing.html
|
| 111 |
+
β βββ script.js # ~15KB β full upload + results UI
|
| 112 |
+
β
|
| 113 |
+
βββ extension/ # Chrome Extension (Manifest V3)
|
| 114 |
+
β βββ manifest.json # Permissions, MV3 config
|
| 115 |
+
β βββ background.js # Service worker (tab capture)
|
| 116 |
+
β βββ content.js # Content script (overlay injection)
|
| 117 |
+
β βββ offscreen.js # Offscreen document for MediaRecorder
|
| 118 |
+
β βββ popup.html / popup.js # Extension popup UI
|
| 119 |
+
β βββ overlay.css # Injected overlay styles
|
| 120 |
+
β βββ icons/ # Extension icons (16/48/128px)
|
| 121 |
+
β
|
| 122 |
+
βββ Dockerfile # Multi-stage Docker build
|
| 123 |
+
βββ render.yaml # Render.com deployment config
|
| 124 |
+
βββ setup.sh / setup.bat # One-command environment setup
|
| 125 |
+
βββ start.sh / start.bat # Dev server launcher
|
| 126 |
+
βββ BUSINESS_MODEL.md # Monetization guide & pricing
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## π Getting Started
|
| 132 |
+
|
| 133 |
+
### Prerequisites
|
| 134 |
+
|
| 135 |
+
| Tool | Version | Purpose |
|
| 136 |
+
|---|---|---|
|
| 137 |
+
| Python | 3.11+ | Backend runtime |
|
| 138 |
+
| Node.js | 18+ | Frontend build |
|
| 139 |
+
| npm / pnpm | Latest | JS package manager |
|
| 140 |
+
| ffmpeg | Any | Video conversion (auto-bundled via imageio-ffmpeg) |
|
| 141 |
+
| Docker | 24+ | Containerized deployment (optional) |
|
| 142 |
+
|
| 143 |
+
> **Windows users:** ffmpeg is bundled via `imageio-ffmpeg` β no manual install required.
|
| 144 |
+
|
| 145 |
+
---
|
| 146 |
+
|
| 147 |
+
### Option A β Quick Start (Local Dev)
|
| 148 |
+
|
| 149 |
+
#### 1. Clone the Repository
|
| 150 |
+
|
| 151 |
+
```bash
|
| 152 |
+
git clone https://github.com/Aarav-bit/Authrix.git
|
| 153 |
+
cd Authrix
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
#### 2. Backend Setup
|
| 157 |
+
|
| 158 |
+
```bash
|
| 159 |
+
cd backend
|
| 160 |
+
python -m venv ../venv
|
| 161 |
+
|
| 162 |
+
# Activate (Linux/macOS)
|
| 163 |
+
source ../venv/bin/activate
|
| 164 |
+
|
| 165 |
+
# Activate (Windows)
|
| 166 |
+
..\venv\Scripts\activate
|
| 167 |
+
|
| 168 |
+
pip install -r requirements.txt
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
> **Note:** First startup downloads ~2 GB of ViT model weights from HuggingFace. Subsequent starts use the local cache.
|
| 172 |
+
|
| 173 |
+
#### 3. Start the Backend
|
| 174 |
+
|
| 175 |
+
```bash
|
| 176 |
+
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
The API will be live at **http://localhost:8000** and the vanilla frontend will be served automatically.
|
| 180 |
+
|
| 181 |
+
#### 4. (Optional) Start the React Frontend
|
| 182 |
+
|
| 183 |
+
```bash
|
| 184 |
+
cd ../frontend
|
| 185 |
+
npm install
|
| 186 |
+
npm run dev
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
React dashboard available at **http://localhost:5173**.
|
| 190 |
+
|
| 191 |
---
|
| 192 |
+
|
| 193 |
+
### Option B β One-Command Setup Scripts
|
| 194 |
+
|
| 195 |
+
```bash
|
| 196 |
+
# Linux / macOS
|
| 197 |
+
./setup.sh
|
| 198 |
+
./start.sh
|
| 199 |
+
|
| 200 |
+
# Windows
|
| 201 |
+
setup.bat
|
| 202 |
+
start.bat
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
---
|
| 206 |
|
| 207 |
+
### Option C β Docker
|
| 208 |
+
|
| 209 |
+
```bash
|
| 210 |
+
# Build image
|
| 211 |
+
docker build -t authrix .
|
| 212 |
+
|
| 213 |
+
# Run
|
| 214 |
+
docker run -p 7860:7860 authrix
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
Open **http://localhost:7860**.
|
| 218 |
+
|
| 219 |
+
---
|
| 220 |
+
|
| 221 |
+
## π Deployment
|
| 222 |
+
|
| 223 |
+
### Render (Recommended)
|
| 224 |
+
|
| 225 |
+
1. Fork this repository.
|
| 226 |
+
2. Create a new **Web Service** on [Render](https://render.com).
|
| 227 |
+
3. Connect your GitHub repo β Render auto-detects `render.yaml`.
|
| 228 |
+
4. Set env vars (see below).
|
| 229 |
+
5. Deploy. β
|
| 230 |
+
|
| 231 |
+
`render.yaml` configures:
|
| 232 |
+
- Runtime: Docker
|
| 233 |
+
- Health check: `GET /health`
|
| 234 |
+
- Port: `8000`
|
| 235 |
+
|
| 236 |
+
### HuggingFace Spaces
|
| 237 |
+
|
| 238 |
+
The `Dockerfile` is pre-configured for HuggingFace Spaces (port 7860, user 1000) and pre-caches both ViT models at build time.
|
| 239 |
+
|
| 240 |
+
1. Create a new Space β **Docker** runtime.
|
| 241 |
+
2. Push this repo as the Space source.
|
| 242 |
+
3. Models are cached in the image β cold start is instant.
|
| 243 |
+
|
| 244 |
+
### Manual VPS
|
| 245 |
+
|
| 246 |
+
```bash
|
| 247 |
+
# Pull latest
|
| 248 |
+
git pull origin main
|
| 249 |
+
|
| 250 |
+
# Build frontend
|
| 251 |
+
cd frontend && npm run build
|
| 252 |
+
cp -r dist ../frontend-dist
|
| 253 |
+
|
| 254 |
+
# Install Python deps
|
| 255 |
+
cd ../backend
|
| 256 |
+
pip install -r requirements.txt
|
| 257 |
+
|
| 258 |
+
# Start with Gunicorn (production)
|
| 259 |
+
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 2
|
| 260 |
+
```
|
| 261 |
+
|
| 262 |
+
---
|
| 263 |
+
|
| 264 |
+
## βοΈ Environment Variables
|
| 265 |
+
|
| 266 |
+
| Variable | Required | Description | Example |
|
| 267 |
+
|---|---|---|---|
|
| 268 |
+
| `PORT` | No | Port to bind | `8000` |
|
| 269 |
+
| `PYTHONUNBUFFERED` | No | Force stdout flush | `1` |
|
| 270 |
+
| `STRIPE_SECRET_KEY` | Optional | Stripe billing | `sk_live_...` |
|
| 271 |
+
| `STRIPE_WEBHOOK_SECRET` | Optional | Stripe webhooks | `whsec_...` |
|
| 272 |
+
|
| 273 |
+
> API keys for end-users are stored in `backend/api_keys.json` (auto-generated). No external database required.
|
| 274 |
+
|
| 275 |
+
---
|
| 276 |
+
|
| 277 |
+
## π API Reference
|
| 278 |
+
|
| 279 |
+
### Base URL
|
| 280 |
+
```
|
| 281 |
+
https://aarav13-authrix.hf.space (production)
|
| 282 |
+
http://localhost:8000 (local)
|
| 283 |
+
```
|
| 284 |
+
|
| 285 |
+
### Authentication
|
| 286 |
+
|
| 287 |
+
Pass your API key as a header. For local development, the key is optional.
|
| 288 |
+
|
| 289 |
+
```
|
| 290 |
+
X-API-Key: authrix_YOUR_KEY_HERE
|
| 291 |
+
```
|
| 292 |
+
|
| 293 |
+
---
|
| 294 |
+
|
| 295 |
+
### `GET /health`
|
| 296 |
+
|
| 297 |
+
Check server readiness.
|
| 298 |
+
|
| 299 |
+
```bash
|
| 300 |
+
curl https://aarav13-authrix.hf.space/health
|
| 301 |
+
```
|
| 302 |
+
|
| 303 |
+
**Response:**
|
| 304 |
+
```json
|
| 305 |
+
{
|
| 306 |
+
"status": "ok",
|
| 307 |
+
"model": "Ensemble (2 ViT models)",
|
| 308 |
+
"ready": true
|
| 309 |
+
}
|
| 310 |
+
```
|
| 311 |
+
|
| 312 |
+
---
|
| 313 |
+
|
| 314 |
+
### `POST /analyze`
|
| 315 |
+
|
| 316 |
+
Analyze an uploaded video file for deepfake content.
|
| 317 |
+
|
| 318 |
+
```bash
|
| 319 |
+
curl -X POST http://localhost:8000/analyze \
|
| 320 |
+
-H "X-API-Key: authrix_YOUR_KEY" \
|
| 321 |
+
-F "file=@/path/to/video.mp4"
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
**Supported formats:** `.mp4`, `.avi`, `.mov`, `.mkv`, `.webm`, `.wmv`
|
| 325 |
+
**Max file size:** 100 MB
|
| 326 |
+
|
| 327 |
+
**Response:**
|
| 328 |
+
```json
|
| 329 |
+
{
|
| 330 |
+
"result": "FAKE",
|
| 331 |
+
"confidence": 87.3,
|
| 332 |
+
"details": {
|
| 333 |
+
"visual_score": 0.82,
|
| 334 |
+
"audio_result": "AI_VOICE",
|
| 335 |
+
"temporal_signals": ["Perfectly uniform motion (CV=0.01)"],
|
| 336 |
+
"metadata_signals": ["c2pa", "tool:runway"],
|
| 337 |
+
"face_coverage": 0.92,
|
| 338 |
+
"frames_analyzed": 38
|
| 339 |
+
},
|
| 340 |
+
"frame_timeline": [
|
| 341 |
+
{ "frame_index": 0, "fake_probability": 0.84 },
|
| 342 |
+
{ "frame_index": 5, "fake_probability": 0.79 }
|
| 343 |
+
],
|
| 344 |
+
"metadata": {
|
| 345 |
+
"frames_analyzed": 38,
|
| 346 |
+
"frames_with_faces": 35,
|
| 347 |
+
"video_duration_sec": 12.4,
|
| 348 |
+
"video_fps": 30.0,
|
| 349 |
+
"resolution": "1280x720"
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
```
|
| 353 |
+
|
| 354 |
+
---
|
| 355 |
+
|
| 356 |
+
### `POST /analyze-url`
|
| 357 |
+
|
| 358 |
+
Analyze a video from a URL (YouTube, TikTok, Twitter, Instagram, etc.).
|
| 359 |
+
|
| 360 |
+
```bash
|
| 361 |
+
curl -X POST http://localhost:8000/analyze-url \
|
| 362 |
+
-H "Content-Type: application/json" \
|
| 363 |
+
-d '{"url": "https://www.youtube.com/watch?v=..."}'
|
| 364 |
+
```
|
| 365 |
+
|
| 366 |
+
**Response:** Same structure as `/analyze`.
|
| 367 |
+
|
| 368 |
+
---
|
| 369 |
+
|
| 370 |
+
### Error Codes
|
| 371 |
+
|
| 372 |
+
| Status | Meaning |
|
| 373 |
+
|---|---|
|
| 374 |
+
| `400` | Bad request (unsupported format, invalid URL) |
|
| 375 |
+
| `401` | Invalid or missing API key |
|
| 376 |
+
| `413` | File too large (>100 MB) |
|
| 377 |
+
| `429` | Monthly usage limit exceeded |
|
| 378 |
+
| `503` | Server still initializing β retry in 30s |
|
| 379 |
+
|
| 380 |
+
---
|
| 381 |
+
|
| 382 |
+
## π° Pricing & Tiers
|
| 383 |
+
|
| 384 |
+
| Tier | Price | Analyses / Month | Features |
|
| 385 |
+
|---|---|---|---|
|
| 386 |
+
| **Free** | $0 | 10 | Extension, 2-min videos, community support |
|
| 387 |
+
| **Pro** | $9.99/mo | 100 | 10-min videos, API access (100 calls), email support |
|
| 388 |
+
| **Business** | $49/mo | 1,000 | Unlimited length, API (5K calls), white-label reports |
|
| 389 |
+
| **Enterprise** | Custom | Unlimited | On-premise, custom training, SLA, dedicated support |
|
| 390 |
+
|
| 391 |
+
### Pay-Per-Use API
|
| 392 |
+
|
| 393 |
+
| Video Length | Price |
|
| 394 |
+
|---|---|
|
| 395 |
+
| < 5 min | $0.05 |
|
| 396 |
+
| 5β15 min | $0.10 |
|
| 397 |
+
| > 15 min | $0.25 |
|
| 398 |
+
|
| 399 |
+
### Generate an API Key (Self-Hosted)
|
| 400 |
+
|
| 401 |
+
```bash
|
| 402 |
+
cd backend
|
| 403 |
+
python create_owner_key.py
|
| 404 |
+
# Or:
|
| 405 |
+
python -c "from auth import create_api_key; print(create_api_key('you@email.com', 'pro'))"
|
| 406 |
+
```
|
| 407 |
+
|
| 408 |
+
---
|
| 409 |
+
|
| 410 |
+
## π§© Browser Extension
|
| 411 |
+
|
| 412 |
+
The Authrix Chrome Extension (v2.2.0, Manifest V3) allows one-click deepfake analysis of any video playing in your browser tab.
|
| 413 |
+
|
| 414 |
+
### How It Works
|
| 415 |
+
|
| 416 |
+
1. User clicks the Authrix toolbar icon while a video is playing.
|
| 417 |
+
2. The background service worker uses the `tabCapture` API to start recording the tab's media stream.
|
| 418 |
+
3. An offscreen document captures ~8 seconds of video via `MediaRecorder`.
|
| 419 |
+
4. The clip is posted to the Authrix API and the result is overlaid on the page.
|
| 420 |
+
|
| 421 |
+
### Install (Developer Mode)
|
| 422 |
+
|
| 423 |
+
1. Open `chrome://extensions`
|
| 424 |
+
2. Enable **Developer Mode** (top-right toggle)
|
| 425 |
+
3. Click **Load unpacked** β select the `extension/` folder
|
| 426 |
+
4. The Authrix icon appears in your toolbar
|
| 427 |
+
|
| 428 |
+
### Permissions
|
| 429 |
+
|
| 430 |
+
| Permission | Reason |
|
| 431 |
+
|---|---|
|
| 432 |
+
| `tabCapture` | Record tab video stream |
|
| 433 |
+
| `scripting` | Inject result overlay |
|
| 434 |
+
| `storage` | Cache API key & usage |
|
| 435 |
+
| `offscreen` | Run MediaRecorder out-of-context |
|
| 436 |
+
| `contextMenus` | Right-click menu |
|
| 437 |
+
|
| 438 |
+
---
|
| 439 |
+
|
| 440 |
+
## π οΈ Development
|
| 441 |
+
|
| 442 |
+
### Backend
|
| 443 |
+
|
| 444 |
+
```bash
|
| 445 |
+
# Run with hot-reload
|
| 446 |
+
uvicorn main:app --reload --port 8000
|
| 447 |
+
|
| 448 |
+
# Run tests
|
| 449 |
+
cd backend
|
| 450 |
+
python test_temporal.py
|
| 451 |
+
|
| 452 |
+
# Lint
|
| 453 |
+
flake8 . --max-line-length=120
|
| 454 |
+
```
|
| 455 |
+
|
| 456 |
+
### Frontend (React)
|
| 457 |
+
|
| 458 |
+
```bash
|
| 459 |
+
cd frontend
|
| 460 |
+
npm run dev # Dev server with HMR
|
| 461 |
+
npm run build # Production build β dist/
|
| 462 |
+
npm run lint # ESLint
|
| 463 |
+
npm run preview # Preview production build
|
| 464 |
+
```
|
| 465 |
+
|
| 466 |
+
### Available Scripts Summary
|
| 467 |
+
|
| 468 |
+
| Command | Description |
|
| 469 |
+
|---|---|
|
| 470 |
+
| `uvicorn main:app --reload` | Backend dev server |
|
| 471 |
+
| `npm run dev` | React frontend dev server |
|
| 472 |
+
| `npm run build` | Build React app for production |
|
| 473 |
+
| `python create_owner_key.py` | Generate a new API key |
|
| 474 |
+
| `docker build -t authrix .` | Build Docker image |
|
| 475 |
+
|
| 476 |
+
---
|
| 477 |
+
|
| 478 |
+
## π¬ Tech Stack
|
| 479 |
+
|
| 480 |
+
### Backend
|
| 481 |
+
- **FastAPI 0.111** β Async REST API with automatic OpenAPI docs
|
| 482 |
+
- **Python 3.11** β Core runtime
|
| 483 |
+
- **OpenCV 4.9** β Video decoding and frame extraction
|
| 484 |
+
- **MediaPipe 0.10** β Face detection (single-context optimized)
|
| 485 |
+
- **HuggingFace Transformers** β ViT model loading and inference
|
| 486 |
+
- **PyTorch 2.3+** β Float16 batched tensor inference
|
| 487 |
+
- **librosa 0.10** β Audio feature extraction and spectral analysis
|
| 488 |
+
- **imageio-ffmpeg** β Bundled ffmpeg binary for video conversion
|
| 489 |
+
- **yt-dlp** β URL-based video download (YouTube, TikTok, etc.)
|
| 490 |
+
- **Stripe** β Payment processing and subscription management
|
| 491 |
+
|
| 492 |
+
### Frontend
|
| 493 |
+
- **React 19** β UI library
|
| 494 |
+
- **Vite 8** β Build tool and dev server
|
| 495 |
+
- **Tailwind CSS 4** β Utility-first styling
|
| 496 |
+
- **Three.js + @react-three/fiber** β 3D particle effects
|
| 497 |
+
- **Framer Motion** β Animations
|
| 498 |
+
- **Zustand** β Lightweight state management
|
| 499 |
+
|
| 500 |
+
### Infrastructure
|
| 501 |
+
- **Docker** β Containerization
|
| 502 |
+
- **Render** β PaaS deployment
|
| 503 |
+
- **HuggingFace Spaces** β Model hosting and demo deployment
|
| 504 |
+
|
| 505 |
+
### AI Models
|
| 506 |
+
|
| 507 |
+
| Model | Source | Purpose |
|
| 508 |
+
|---|---|---|
|
| 509 |
+
| `dima806/deepfake_vs_real_image_detection` | HuggingFace | Primary ViT classifier |
|
| 510 |
+
| `prithivMLmods/Deep-Fake-Detector-v2-Model` | HuggingFace | Secondary ViT classifier |
|
| 511 |
+
|
| 512 |
+
---
|
| 513 |
+
|
| 514 |
+
## π§ Troubleshooting
|
| 515 |
+
|
| 516 |
+
### Server takes a long time to start
|
| 517 |
+
|
| 518 |
+
**Cause:** HuggingFace models (~1β2 GB) are being downloaded on first run.
|
| 519 |
+
**Fix:** Wait ~2β5 minutes. Subsequent starts use the local cache at `~/.cache/huggingface/`.
|
| 520 |
+
|
| 521 |
+
### `Could not open video` / OpenCV error on Windows
|
| 522 |
+
|
| 523 |
+
**Cause:** OpenCV on Windows cannot natively decode `.webm` or `.mkv`.
|
| 524 |
+
**Fix:** The backend automatically converts these via bundled ffmpeg. Ensure `imageio-ffmpeg` is installed:
|
| 525 |
+
```bash
|
| 526 |
+
pip install imageio-ffmpeg
|
| 527 |
+
```
|
| 528 |
+
|
| 529 |
+
### Extension not sending data to the API
|
| 530 |
+
|
| 531 |
+
**Cause:** The extension is hard-coded to connect to `http://localhost:8000` (dev) or `https://aarav13-authrix.hf.space` (prod).
|
| 532 |
+
**Fix:** Update `host_permissions` in `extension/manifest.json` to match your deployment URL, then reload the extension.
|
| 533 |
+
|
| 534 |
+
### `429 Monthly limit exceeded`
|
| 535 |
+
|
| 536 |
+
**Cause:** Your API key has hit its monthly quota.
|
| 537 |
+
**Fix:** Upgrade your plan, or generate a new owner key locally:
|
| 538 |
+
```bash
|
| 539 |
+
python create_owner_key.py
|
| 540 |
+
```
|
| 541 |
+
|
| 542 |
+
### `503 Server still initializing`
|
| 543 |
+
|
| 544 |
+
**Cause:** The ViT models haven't finished loading yet.
|
| 545 |
+
**Fix:** Hit `GET /health` and wait until `"ready": true`, then retry.
|
| 546 |
+
|
| 547 |
+
### Audio analysis not available
|
| 548 |
+
|
| 549 |
+
**Cause:** `librosa`, `soundfile`, or `moviepy` not installed, or the video has no audio track.
|
| 550 |
+
**Fix:**
|
| 551 |
+
```bash
|
| 552 |
+
pip install librosa soundfile moviepy
|
| 553 |
+
```
|
| 554 |
+
|
| 555 |
+
---
|
| 556 |
+
|
| 557 |
+
## πΊοΈ Roadmap
|
| 558 |
+
|
| 559 |
+
- [ ] Firefox extension support
|
| 560 |
+
- [ ] Real-time video stream analysis via WebSocket
|
| 561 |
+
- [ ] Mobile app (React Native)
|
| 562 |
+
- [ ] Batch analysis endpoint for enterprise workflows
|
| 563 |
+
- [ ] Webhook notifications for async analysis
|
| 564 |
+
- [ ] GDPR-compliant EU data residency option
|
| 565 |
+
- [ ] On-premise deployment Helm chart
|
| 566 |
+
- [ ] Fine-tuned model on latest Veo3 / Sora outputs
|
| 567 |
+
|
| 568 |
+
---
|
| 569 |
+
|
| 570 |
+
## π€ Contributing
|
| 571 |
+
|
| 572 |
+
Contributions are welcome! Please follow these steps:
|
| 573 |
+
|
| 574 |
+
1. Fork the repository
|
| 575 |
+
2. Create a feature branch: `git checkout -b feat/my-feature`
|
| 576 |
+
3. Commit your changes: `git commit -m 'feat: add my feature'`
|
| 577 |
+
4. Push to the branch: `git push origin feat/my-feature`
|
| 578 |
+
5. Open a Pull Request
|
| 579 |
+
|
| 580 |
+
Please make sure your code passes linting before submitting.
|
| 581 |
+
|
| 582 |
+
---
|
| 583 |
+
|
| 584 |
+
## π License
|
| 585 |
+
|
| 586 |
+
This project is licensed under the **MIT License** β see the [LICENSE](LICENSE) file for details.
|
| 587 |
+
|
| 588 |
+
---
|
| 589 |
+
|
| 590 |
+
## π§ Contact
|
| 591 |
+
|
| 592 |
+
| Channel | Link |
|
| 593 |
+
|---|---|
|
| 594 |
+
| Enterprise Sales | enterprise@authrix.ai |
|
| 595 |
+
| Live Demo | https://aarav13-authrix.hf.space |
|
| 596 |
+
| API Docs | https://aarav13-authrix.hf.space/docs |
|
| 597 |
+
|
| 598 |
+
---
|
| 599 |
+
|
| 600 |
+
<div align="center">
|
| 601 |
+
|
| 602 |
+
**Built with β€οΈ by the Authrix Team**
|
| 603 |
|
| 604 |
+
*Fighting misinformation, one frame at a time.*
|
| 605 |
|
| 606 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|