Deepfake Authenticator commited on
Commit
470a637
Β·
1 Parent(s): 4d23473

docs: add comprehensive README for Authrix deepfake detection engine

Browse files
Files changed (1) hide show
  1. README.md +601 -14
README.md CHANGED
@@ -1,19 +1,606 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: Authrix Deepfake Detector
3
- emoji: πŸ”
4
- colorFrom: green
5
- colorTo: green
6
- sdk: docker
7
- pinned: false
8
- app_port: 7860
 
 
 
 
 
 
9
  ---
10
 
11
- # Authrix β€” AI Deepfake Detection Engine
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- Upload a video and get an instant REAL / FAKE verdict powered by an ensemble of ViT models.
14
 
15
- ## Features
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
+ [![Python](https://img.shields.io/badge/Python-3.11+-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org)
7
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.111-009688?style=for-the-badge&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com)
8
+ [![React](https://img.shields.io/badge/React-19-61DAFB?style=for-the-badge&logo=react&logoColor=black)](https://react.dev)
9
+ [![HuggingFace](https://img.shields.io/badge/πŸ€—_HuggingFace-ViT_Ensemble-FFD21E?style=for-the-badge)](https://huggingface.co)
10
+ [![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white)](https://docker.com)
11
+ [![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](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>