TruthLens
Real-Time Deepfake & Media Authenticity Shield
🎥 Video
🎤 Audio
🖼 Image
⚡ Real-Time
📝 Text
🛡 Production Ready
TruthLens is a full-stack, AI-powered platform that detects deepfake videos, cloned voices, AI-generated images, and AI-written text — in real time — before misinformation spreads. Built for the general public, journalists, enterprises, and researchers who need to trust the media they consume and share.
TruthLens is the most essential tool in the age of synthetic media. Whether you're a content creator, news professional, cybersecurity researcher, social media moderator, or an everyday internet user — TruthLens has you covered.
| 🎯 Problem | 💡 TruthLens Solution |
|---|---|
| Deepfakes are indistinguishable to the human eye | EfficientNet-B4 + MTCNN per-frame analysis |
| Voice cloning fools millions daily | Wav2Vec 2.0 spectral & prosody fingerprinting |
| AI images flood social media | CLIP classifier + GAN artifact FFT detection |
| AI-generated text spreads as real news | RoBERTa classifier + burstiness/entropy heuristics |
| No browser-native protection exists | Chrome Extension (MV3) scans pages automatically |
| No unified dashboard for teams | React analytics dashboard with real-time charts |
| Manual review is slow and error-prone | Batch scanning API — analyse 10 items in one call |
| No audit trail for compliance | CSV/JSON history export for reporting & forensics |
╔════════════════════════════════════════════════════════════════════════════════════╗
║ TRUTHLENS FEATURE MAP v2.0 ║
╠══════════════╦══════════════════╦═══════════════════╦════════════╦════════════════╣
║ 🎥 VIDEO ║ 🎙️ AUDIO ║ 🖼️ IMAGE ║ 📝 TEXT ║ 🛡️ PLATFORM ║
╠══════════════╬══════════════════╬═══════════════════╬════════════╬════════════════╣
║ EfficientNet ║ Wav2Vec 2.0 ║ CLIP Embeddings ║ RoBERTa ║ FastAPI REST ║
║ B4 deepfake ║ voice clone ║ AI-gen classifier ║ AI-text ║ JWT + API key ║
║ classifier ║ detection ║ ║ detector ║ auth ║
║ ║ ║ ║ ║ ║
║ MTCNN face ║ Mel spectrogram ║ GAN artifact FFT ║ Burstiness ║ Redis rate ║
║ detection & ║ analysis ║ (checkerboard ║ & entropy ║ limiting ║
║ alignment ║ ║ pattern detect) ║ analysis ║ (60 req/min) ║
║ ║ ║ ║ ║ ║
║ 30-frame ║ Prosody variance ║ EXIF metadata ║ LLM model ║ PostgreSQL ║
║ temporal ║ anomaly check ║ inconsistency ║ guess ║ history ║
║ analysis ║ ║ analysis ║ ║ Chrome Ext MV3 ║
║ ║ ║ ║ ║ React dashboard║
║ ║ ║ ║ ║ Batch scan API ║
║ ║ ║ ║ ║ CSV/JSON export║
╚══════════════╩══════════════════╩═══════════════════╩════════════╩════════════════╝
Detect whether an article, social media post, email, or document was written by a large language model (ChatGPT, GPT-4, Claude, Gemini, Llama, Mistral, etc.) using:
- RoBERTa-base fine-tuned on OpenAI's human/AI text dataset
- Burstiness analysis — human writing has variable sentence length; LLMs don't
- Lexical entropy — detect unnaturally uniform vocabulary
- LLM phrase fingerprinting — "furthermore", "it is important to note", etc.
- Returns
generator_model_guess(e.g., "GPT-4 / Claude / Gemini")
Analyse up to 10 media items in a single API call — mix videos, images, audio clips, and text in one request. Perfect for:
- Social media moderation pipelines
- News agency verification workflows
- Enterprise compliance auditing
Export your complete scan history for:
- Compliance reporting and forensic audits
- Integration with SIEM tools and dashboards
- Offline analysis in Excel, pandas, or BI tools
Every detection returns a 4-tier risk level (Low / Medium / High / Critical) with confidence scores, artifact lists, and generator model guesses — giving you full transparency into every decision.
The Chrome Extension automatically scans media on YouTube, Twitter/X, Facebook, Instagram, LinkedIn, Reddit, TikTok, and any web page — with visual overlays that appear before you share.
graph TB
subgraph CLIENT ["🌐 Client Layer"]
EXT["🔌 Chrome Extension<br/>React 18 · MV3<br/>8 Social Platforms"]
DASH["📊 Web Dashboard<br/>React 18 · TypeScript<br/>Recharts · Zustand"]
end
subgraph API ["⚡ API Gateway · FastAPI"]
AUTH["🔐 /api/auth<br/>JWT · API Keys"]
DETECT["🔍 /api/detect<br/>video · audio · image · text · batch"]
HISTORY["📜 /api/history<br/>Scan Records · CSV/JSON Export"]
RATE["🚦 Rate Limiter<br/>Redis · 60 req/min"]
end
subgraph ML ["🧠 ML Engine · PyTorch 2.6"]
VID["🎥 VideoDetector<br/>EfficientNet-B4<br/>MTCNN Face Detect"]
AUD["🎙️ AudioDetector<br/>Wav2Vec 2.0<br/>Mel Spectrogram"]
IMG["🖼️ ImageDetector<br/>CLIP ViT-B/32<br/>FFT GAN Artifacts"]
TXT["📝 TextDetector<br/>RoBERTa-base<br/>Burstiness + Entropy"]
META["📋 MetaAnalyzer<br/>EXIF · C2PA"]
end
subgraph DATA ["🗄️ Data Layer"]
PG[("🐘 PostgreSQL 16<br/>Users · Scan History")]
RD[("🔴 Redis 7<br/>Rate Limits · Cache")]
end
EXT -->|"HTTPS + Bearer token"| AUTH
EXT -->|"base64 media"| DETECT
DASH -->|"HTTPS + Bearer token"| AUTH
DASH --> DETECT
DASH --> HISTORY
AUTH --> PG
DETECT --> RATE
RATE --> RD
DETECT --> VID
DETECT --> AUD
DETECT --> IMG
DETECT --> TXT
IMG --> META
HISTORY --> PG
VID -->|"frame scores"| DETECT
AUD -->|"artifact list"| DETECT
IMG -->|"confidence + artifacts"| DETECT
TXT -->|"ai_artifacts + guess"| DETECT
sequenceDiagram
actor User
participant EXT as 🔌 Extension
participant BG as ⚙️ Service Worker
participant API as ⚡ FastAPI
participant ML as 🧠 ML Engine
participant DB as 🗄️ PostgreSQL
User->>EXT: Clicks "Scan This Page"
EXT->>EXT: content-script scans DOM<br/>finds video/audio/image/text
EXT->>BG: GET_MEDIA_INFO → payload
BG->>API: POST /api/detect/{type}<br/>Authorization: Bearer <key>
API->>API: Validate JWT / API key
API->>API: Rate limit check (Redis)
API->>ML: Run detector async
ML->>ML: Preprocess media
ML->>ML: Run model inference
ML->>ML: Compute confidence score
ML-->>API: {score, artifacts, guess}
API->>DB: Save scan record
API-->>BG: JSON response
BG-->>EXT: risk_level + confidence
EXT->>User: 🔴 Overlay / ✅ Badge
flowchart LR
subgraph VIDEO ["🎥 Video Pipeline"]
V1["📥 Input URL<br/>or base64 frames"] --> V2["🎞️ OpenCV<br/>Extract 30 frames"]
V2 --> V3["👤 MTCNN<br/>Face Detection"]
V3 --> V4["🧠 EfficientNet-B4<br/>Per-frame score"]
V4 --> V5{"40% frames<br/>> 0.7 conf?"}
V5 -->|Yes| V6["🔴 DEEPFAKE"]
V5 -->|No| V7["✅ AUTHENTIC"]
end
subgraph AUDIO ["🎙️ Audio Pipeline"]
A1["📥 base64 audio"] --> A2["🔊 Decode + Resample<br/>16 kHz mono"]
A2 --> A3["📊 Mel Spectrogram<br/>128 bins"]
A3 --> A4["🧠 Wav2Vec 2.0<br/>Embeddings"]
A4 --> A5["🔬 Artifact Detection<br/>flatness · prosody · periodicity"]
A5 --> A6{"Score > 0.5?"}
A6 -->|Yes| A7["🔴 VOICE CLONE"]
A6 -->|No| A8["✅ AUTHENTIC"]
end
subgraph IMAGE ["🖼️ Image Pipeline"]
I1["📥 base64 image"] --> I2["🖼️ PIL Decode<br/>RGB normalise"]
I2 --> I3["🧠 CLIP ViT-B/32<br/>512-d embedding"]
I3 --> I4["🔬 Logistic Head<br/>Binary classifier"]
I2 --> I5["📡 FFT Analysis<br/>GAN artifact detection"]
I2 --> I6["📋 EXIF Parser<br/>Metadata check"]
I4 & I5 & I6 --> I7{"Aggregate<br/>score > 0.5?"}
I7 -->|Yes| I8["🔴 AI GENERATED"]
I7 -->|No| I9["✅ AUTHENTIC"]
end
subgraph TEXT ["📝 Text Pipeline"]
T1["📥 Raw text"] --> T2["✂️ Truncate<br/>512 tokens"]
T2 --> T3["🧠 RoBERTa-base<br/>Sequence classifier"]
T1 --> T4["📊 Burstiness<br/>sentence length variance"]
T1 --> T5["🔬 Entropy<br/>char-level uniformity"]
T1 --> T6["🔍 Phrase<br/>fingerprinting"]
T3 & T4 & T5 & T6 --> T7{"Blended<br/>score > 0.5?"}
T7 -->|Yes| T8["🔴 AI GENERATED"]
T7 -->|No| T9["✅ HUMAN WRITTEN"]
end
TruthLens-/
│
├── 📁 backend/ # Python 3.11 · FastAPI · PyTorch
│ ├── main.py # App entry, CORS, lifespan hooks
│ ├── api/routes/
│ │ ├── auth.py # POST /register /login GET /apikey
│ │ ├── detect.py # POST /video /audio /image /text /batch
│ │ └── history.py # GET /history GET /history/export
│ ├── ml/
│ │ ├── video_detector.py # EfficientNet-B4 + MTCNN
│ │ ├── audio_detector.py # Wav2Vec 2.0 classifier
│ │ ├── image_detector.py # CLIP + FFT GAN detector
│ │ ├── text_detector.py # RoBERTa AI-text classifier ← NEW
│ │ ├── model_loader.py # Async model bootstrap
│ │ └── preprocessors.py # Frames, mel, base64 utils
│ ├── db/
│ │ ├── models.py # SQLAlchemy ORM (User, ScanResult)
│ │ └── schemas.py # Pydantic schemas
│ ├── utils/
│ │ ├── rate_limiter.py # Redis sliding-window
│ │ └── metadata_analyzer.py # EXIF / C2PA checks
│ ├── requirements.txt
│ └── Dockerfile
│
├── 📁 extension/ # Chrome Extension · Manifest V3
│ ├── manifest.json # MV3, 8 platform host perms
│ ├── src/
│ │ ├── popup/Popup.tsx # React popup UI
│ │ ├── content/content-script.ts # DOM scanner + overlay
│ │ ├── background/service-worker.ts # Alarm + API relay
│ │ └── components/ # RiskBadge, ScanResult
│ └── vite.config.ts
│
├── 📁 dashboard/ # Web Dashboard · React 18 · TS
│ └── src/
│ ├── pages/
│ │ ├── Home.tsx # Quick scan + stats
│ │ ├── History.tsx # Scan history table
│ │ ├── Analytics.tsx # Recharts visualisations
│ │ └── Settings.tsx # Auth + API key mgmt
│ ├── store/useStore.ts # Zustand + persist
│ ├── api/client.ts # Axios + JWT interceptor
│ └── components/ # Navbar, StatCard, RiskBadge
│
└── 🐳 docker-compose.yml # postgres · redis · backend · dashboard
# 1. Clone
git clone https://github.com/Rahulchaube1/TruthLens-
cd TruthLens-
# 2. Set secrets (optional — defaults work for local dev)
export JWT_SECRET_KEY=your-super-secret-key
export POSTGRES_PASSWORD=your-db-password
# 3. Launch everything
docker-compose up --build| Service | URL |
|---|---|
| 🔵 REST API | http://localhost:8000 |
| 📘 Swagger Docs | http://localhost:8000/docs |
| 📊 Dashboard | http://localhost:3000 |
🐍 Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000📊 Dashboard
cd dashboard
npm install
npm run dev # → http://localhost:3000🔌 Chrome Extension
cd extension
npm install
npm run build # → extension/dist/- Open
chrome://extensions - Enable Developer mode (top-right toggle)
- Click Load unpacked → select
extension/dist/ - Pin TruthLens to your toolbar — done! 🎉
POST /api/auth/register
Content-Type: application/json
{ "email": "user@example.com", "password": "s3cr3t!", "name": "Alice" }POST /api/auth/login
Content-Type: application/json
{ "email": "user@example.com", "password": "s3cr3t!" }GET /api/auth/apikey
Authorization: Bearer <jwt_token>POST /api/detect/video
Authorization: Bearer <token>
{
"url": "https://example.com/video.mp4",
"frames": ["<base64_frame_1>", "<base64_frame_2>"]
}POST /api/detect/audio
Authorization: Bearer <token>
{
"audio_base64": "<base64_audio>",
"duration_seconds": 12.5
}// Response
{
"is_cloned": true,
"confidence": 0.73,
"voice_artifacts": ["high_spectral_flatness", "low_prosody_variance"],
"synthesis_model_guess": "Tortoise-TTS / VALL-E"
}POST /api/detect/image
Authorization: Bearer <token>
{
"image_base64": "<base64_image>",
"check_metadata": true
}// Response
{
"is_ai_generated": true,
"confidence": 0.94,
"gan_artifacts": true,
"metadata_inconsistencies": ["No EXIF metadata found — possible AI generation"],
"generator_model_guess": "Stable Diffusion / DALL-E"
}POST /api/detect/text
Authorization: Bearer <token>
{
"text": "Paste any article, social media post, or document here..."
}// Response
{
"is_ai_generated": true,
"confidence": 0.91,
"ai_artifacts": ["low_burstiness", "repetitive_phrasing"],
"generator_model_guess": "GPT-4 / Claude / Gemini",
"word_count": 312,
"sentence_count": 18,
"risk_level": "critical"
}Analyse up to 10 items (any mix of types) in a single request:
POST /api/detect/batch
Authorization: Bearer <token>
{
"items": [
{ "type": "video", "url": "https://example.com/video.mp4" },
{ "type": "image", "image_base64": "<base64>" },
{ "type": "text", "text": "Article content here..." },
{ "type": "audio", "audio_base64": "<base64>", "duration_seconds": 8.0 }
]
}// Response
{
"results": [
{ "index": 0, "type": "video", "success": true, "result": { "is_deepfake": false, "confidence": 0.12, "risk_level": "low" }, "detection_time_ms": 210 },
{ "index": 1, "type": "image", "success": true, "result": { "is_ai_generated": true, "confidence": 0.88, "risk_level": "critical" }, "detection_time_ms": 145 },
{ "index": 2, "type": "text", "success": true, "result": { "is_ai_generated": true, "confidence": 0.79, "risk_level": "high" }, "detection_time_ms": 98 },
{ "index": 3, "type": "audio", "success": true, "result": { "is_cloned": false, "confidence": 0.21 }, "detection_time_ms": 320 }
],
"total": 4,
"succeeded": 4,
"failed": 0,
"total_time_ms": 773
}GET /api/history?limit=50
Authorization: Bearer <token># Export as CSV (for Excel, pandas, BI tools)
GET /api/history/export?format=csv&limit=500
Authorization: Bearer <token>
# Export as JSON (for SIEM, APIs, forensics)
GET /api/history/export?format=json&limit=500
Authorization: Bearer <token>| Variable | Default | Required | Description |
|---|---|---|---|
JWT_SECRET_KEY |
(insecure default) | Yes | JWT signing secret — change in prod |
POSTGRES_PASSWORD |
changeme |
Yes | PostgreSQL password |
DATABASE_URL |
auto-built | No | Full asyncpg connection string |
REDIS_URL |
redis://localhost:6379/0 |
No | Redis connection URL |
VITE_API_BASE |
http://backend:8000/api |
No | Dashboard API base URL |
| Feature | Detail |
|---|---|
| 🔑 JWT Auth | 24-hour expiring tokens, HS256 signed |
| 🗝️ API Keys | Per-user keys for extension, prefixed tl_ |
| 🚦 Rate Limiting | Redis sliding-window, 60 requests/minute |
| 🔒 Base64 Padding | Correct (-len % 4) padding — no double-pad bugs |
| 🌐 CORS | Configurable allow_origins — lock down in production |
| App warns at startup if default JWT secret is used | |
| 📦 Dependencies | All deps pinned to CVE-free versions (Pillow 12.1.1, torch 2.6.0, transformers 4.48.0) |
| 🔏 Export Auth | History export requires valid JWT — no anonymous access |
| Level | Score Range | Colour | Meaning |
|---|---|---|---|
| ✅ Low | 0.00 – 0.30 | 🟢 Green | Likely authentic |
| 0.30 – 0.60 | 🟡 Yellow | Suspicious — verify manually | |
| 🔶 High | 0.60 – 0.85 | 🟠 Orange | Strong deepfake signals |
| 🔴 Critical | 0.85 – 1.00 | 🔴 Red | Almost certainly fake — do not share |
| Who | How They Use TruthLens |
|---|---|
| 📰 Journalists & Fact-Checkers | Verify video/audio evidence before publishing; detect AI-written press releases |
| 🏢 Enterprise & Legal Teams | Audit media submissions; export CSV reports for compliance |
| 🎓 Academic Researchers | Batch-analyse datasets; study deepfake signatures |
| 🔒 Cybersecurity Professionals | Integrate batch API into SIEM pipelines; detect social engineering |
| 📱 Social Media Managers | Auto-scan content before posting; avoid sharing synthetic media |
| 👤 General Public | Chrome Extension gives instant protection on any website |
| 🏛️ Government & NGOs | Counter disinformation campaigns in elections and crisis events |
Contributions are what make open source amazing! 🚀
1. 🍴 Fork the repo
2. 🌿 Create a feature branch → git checkout -b feat/amazing-feature
3. 💾 Commit your changes → git commit -m 'feat: add amazing feature'
4. 📤 Push to your branch → git push origin feat/amazing-feature
5. 🔃 Open a Pull Request → and describe your changes!
Please follow Conventional Commits for commit messages.
deepfake detection, AI-generated content detection, voice clone detection, face swap detection, synthetic media, misinformation detection, disinformation tool, media authenticity, fake video detector, deepfake checker, AI text detector, ChatGPT detector, GPT-4 detector, Claude detector, Gemini detector, AI image detector, GAN detection, Stable Diffusion detector, DALL-E detector, real-time deepfake, browser extension deepfake, Chrome extension AI detector, FastAPI ML, PyTorch deepfake, EfficientNet deepfake, Wav2Vec voice clone, CLIP image classifier, RoBERTa AI text, fact-checking tool, media forensics, digital forensics, content verification, online safety, cybersecurity, social media safety, anti-disinformation, journalism tool, synthetic audio detection, audio deepfake, video manipulation detection, face forgery detection, neural deepfake, open-source deepfake detector, TruthLens, Rahul Chaube
MIT License
Copyright (c) 2024 Rahul Chaube
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
TruthLens is designed, built, and maintained by Rahul Chaube.
"In a world where seeing is no longer believing, TruthLens gives you back the power to know what's real."
— Rahul Chaube, Creator of TruthLens
Built with ❤️ by Rahul Chaube to fight misinformation — one frame at a time.
© 2024 Rahul Chaube. All rights reserved. Distributed under the MIT License.
⭐ Star this repo if TruthLens helps you — it means the world and helps others find it! ⭐