Spaces:
Sleeping
title: Radai Api
emoji: ๐ง
colorFrom: blue
colorTo: indigo
sdk: docker
app_file: app.py
pinned: false
๐ง RADAI โ Real-Time AI Image Detection Extension
Bringing trust back to the internet โ one image at a time.
Report Bug โข Request Feature โข View Demo
Built for Prakalp 4.0
โจ What is AI Detector?
With the explosion of generative AI tools like Stable Diffusion, Midjourney, and DALLยทE, distinguishing real images from synthetic ones has become nearly impossible for the human eye.
RADAI is a real-time deepfake detection Chrome extension that scans every image on any webpage and classifies it as:
- ๐ง AI Generated โ flagged with a red border and confidence score
- ๐ท Real โ confirmed with a green border and confidence score
It doesn't just stop there. It calculates a full page-level risk score so you can instantly understand how much synthetic content you're being served โ on any website, at any time.
In a world where AI can generate anything โ this system helps you understand what is real.
๐ Features
๐ Real-Time Image Scanning
- Detects all visible images on any webpage
- Works on Google Images, blogs, news sites, social media โ anywhere
- Ignores hidden or non-visible DOM elements for accurate results
๐ฏ AI vs Real Classification
- Powered by OpenCLIP (ViT-L-14) & ConvNeXt-Base deep vision models
- Transfer learning with a custom binary classification head
- Outputs a clean probability score per image
๐จ Visual Highlighting
- ๐ด Red border โ AI Generated
- ๐ข Green border โ Real
- Hover over any image to see its label + confidence score
๐ Page Risk Analysis
Calculates an overall AI content percentage for the entire page:
| Risk Level | Range | Meaning |
|---|---|---|
| ๐ข Low Risk | 0โ30% | Mostly real content |
| ๐ก Moderate Risk | 30โ70% | Mixed content |
| ๐ด High Risk | 70โ100% | Mostly AI-generated |
โก Clean UI/UX
- Minimal, Apple-inspired design
- Fast and non-intrusive
- Confidence scores displayed inline
โ๏ธ How It Works
Step 1 โ Image Extraction
The extension scans the webpage DOM and collects all visible <img> elements, extracting their src URLs for backend processing.
Step 2 โ URL-Based Backend Processing
Image URLs are sent directly to the Flask backend โ no screenshots, no compression artifacts. This ensures maximum accuracy and faster processing.
Step 3 โ Feature Extraction via OpenCLIP
The backend uses a frozen OpenCLIP (ViT-L-14) backbone pretrained on datacomp_xl_s13b_b90k to convert each image into rich deep feature embeddings.
Step 4 โ Custom Classification Head
A lightweight neural network processes those embeddings:
Linear โ ReLU โ Dropout โ Linear โ Sigmoid
Output: A probability score indicating how likely the image is AI-generated.
Step 5 โ UI Rendering
Results are pushed back to the extension, which:
- Highlights each image directly on the page
- Overlays confidence labels on hover
- Updates the popup with page-level risk analysis
๐งช Model Details
| Property | Value |
|---|---|
| Ensemble | OpenCLIP (ViT-L-14) + ConvNeXt-Base |
| Pretrained On | datacomp_xl_s13b_b90k |
| Approach | Transfer Learning |
| Encoder | Frozen |
| Head | Custom Binary Classifier |
| Output | AI / Real + Probability |
๐ Training Dataset
AI Images: Stable Diffusion, Midjourney, DALLยทE, Flux
Real Images: Unsplash dataset
๐ Project Structure
extension-deepfake/
โ
โโโ app.py # Flask backend โ model inference & API
โโโ OpenCLIP_forensic_head.pth # Trained model weights
โโโ train.py # Training script (reference only)
โ
โโโ extension/
โโโ manifest.json # Chrome extension configuration
โโโ popup.html # Extension UI layout
โโโ popup.js # Button logic & UI state updates
โโโ content.js # DOM scanning & image highlighting
โ๏ธ Setup & Installation
Prerequisites
- Python 3.8+
- pip
- Google Chrome browser
1. Clone the Repository
git clone https://github.com/How2Invade/extension-deepfake.git
cd extension-deepfake
2. Install Backend Dependencies
pip install torch torchvision flask pillow open_clip_torch
3. Run the Flask Backend
python app.py
The server will start at:
http://127.0.0.1:5000
Keep this terminal running while using the extension.
4. Load the Chrome Extension
- Open Chrome and navigate to
chrome://extensions/ - Toggle Developer Mode (top right)
- Click Load Unpacked
- Select the
extension/folder from the cloned repo
5. Start Detecting
- Open any webpage (try Google Images)
- Click the AI Detector extension icon
- Hit Scan Images
Every image on the page will be analyzed and highlighted instantly.
๐ฏ Output
Each scanned image receives:
- A colored border (Red = AI, Green = Real)
- A confidence label on hover (e.g.,
AI โ 78%orReal โ 64%)
The popup displays:
- Overall risk percentage
- Page-level verdict (Low / Moderate / High Risk)
๐ฎ Future Scope
- ๐ฅ Video deepfake detection โ frame-by-frame analysis
- ๐๏ธ Audio deepfake detection โ voice synthesis identification
- โ๏ธ Cloud deployment โ remove the local backend requirement
- ๐ Advanced analytics dashboard โ historical scan data & trends
- โก Batch inference optimization โ faster multi-image processing
โ ๏ธ Limitations
- Accuracy depends on training data coverage
- Some false positives may occur on heavily stylized images
- Backend must be running locally for the extension to work
๐ Impact
AI Detector directly addresses one of the most pressing issues of the AI era:
- โ Detecting fake and synthetic content at scale
- โ Reducing the spread of AI-powered misinformation
- โ Empowering users to verify what they see online
- โ Assisting journalists, researchers, and media professionals
๐ Acknowledgments
- OpenCLIP for the OpenCLIP vision model
- PyTorch ecosystem for model training and inference
- Chrome Extensions API for browser integration
- Unsplash for real image training data