A real-time AI safety layer that detects deepfakes as you scroll.
Built for the Gemini 3 Hackathon by Google DeepMind
🎬 Demo Video • 🚀 Quick Start • 🏗️ Architecture • 🤖 Gemini Integration
We live in the "scroll era" - endless feeds of Reels, Shorts, and TikToks. Deepfakes blend seamlessly into this content, and traditional detection tools require you to:
- Stop scrolling
- Copy/download the video
- Upload to a website
- Wait for analysis
Nobody does this. The friction is too high. By the time you verify, you've already moved on.
DeepGuard v2 is a real-time deepfake detection overlay that:
- 🛡️ Sits on top of your screen - Always watching, never intrusive
- ⚡ Analyzes in real-time - No uploading, no waiting
- 🎨 Shows confidence levels - 5-tier system from 🟢 REAL to 🔴 DEEPFAKE
- 🤖 Explains with Gemini - Human-readable explanations powered by Google's AI
- 📱 Works everywhere - Instagram, YouTube, TikTok, any website, any app
Think of it as an antivirus for deepfakes.
┌─────────────────────────────────────────────────────────────────┐
│ DeepGuard v2 Architecture │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Screen │───▶│ Face │───▶│ MesoNet │ │
│ │ Capture │ │ Detection │ │ Model │ │
│ │ (mss) │ │ (MTCNN) │ │ (256x256) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Temporal Aggregation Engine │ │
│ │ • 30-frame sliding window │ │
│ │ • Weighted averaging (exponential decay) │ │
│ │ • Trend detection (rising/falling/stable) │ │
│ └──────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Confidence │───▶│ Gemini │───▶│ Overlay │ │
│ │ Classifier │ │ Explainer │ │ Window │ │
│ │ (5-tier) │ │ (API) │ │ (PyQt6) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
| Component | Technology | Purpose |
|---|---|---|
| Screen Capture | mss |
Captures screen at 10+ FPS with thread-safety |
| Face Detection | MTCNN | Locates faces in captured frames |
| Deepfake Model | MesoNet (Keras) | CNN trained on FaceForensics++ dataset |
| Temporal Engine | Custom | Smooths predictions over 30 frames |
| Confidence System | Custom | Maps scores to 5 human-readable levels |
| Explainer | Gemini API | Generates natural language explanations |
| Overlay | PyQt6 | Floating, draggable, always-on-top window |
Gemini is central to DeepGuard's user experience.
DeepGuard's ML pipeline produces technical outputs (probability scores, frame counts, trends). Gemini transforms these into human-understandable explanations:
# Technical Detection Result
{
"level": "LIKELY_FAKE",
"score": 0.72,
"confidence_pct": 78,
"trend": "rising",
"frames_analyzed": 30
}
# Gemini Transforms To:
"This video shows signs of digital manipulation. The face movements
appear inconsistent with natural expressions. Consider verifying
this content from trusted sources before sharing."- Real-time speed -
gemini-2.0-flash-expprovides sub-second responses - Contextual understanding - Adapts explanations based on confidence levels and trends
- User-friendly - No technical jargon, actionable advice
- Graceful degradation - Falls back to deterministic templates if API unavailable
# From core/explainer.py
from google import genai
class GeminiExplainer:
def __init__(self):
self.client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
def explain(self, result: DetectionResult) -> str:
prompt = f"""You are an AI safety assistant explaining deepfake detection.
Classification: {result.level.value}
Confidence: {result.confidence_pct}%
Trend: {result.trend}
Generate a brief, helpful explanation (2-3 sentences) for a non-technical user."""
response = self.client.models.generate_content(
model="gemini-2.0-flash-exp",
contents=prompt
)
return response.text- ✅ Text Generation - Natural language explanations
- ✅ Fast Inference - Real-time responses with Flash model
- ✅ Safety Filtering - Built-in content safety
- ✅ Structured Prompting - Consistent, contextual outputs
- Python 3.10+
- Windows 10/11 (overlay optimized for Windows)
- Gemini API Key (Get one free)
# Clone the repository
git clone https://github.com/omtripathi52/deepguard.git
cd deepguard
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
# Set Gemini API key
set GEMINI_API_KEY=your_api_key_here # Windows
# export GEMINI_API_KEY=your_api_key_here # Linux/Mac
# Run DeepGuard v2 Overlay
python main.pypython main.py- Floating overlay appears in top-right corner
- Browse Instagram, YouTube, TikTok normally
- Watch the shield change colors based on detection
- Hover for Gemini explanation
- Drag to reposition
- Click ✕ to close
Confidence Levels:
- 🟢 REAL - Authentic content
- 🟢 LIKELY REAL - Probably authentic
- 🟡 UNCERTAIN - Cannot determine
- 🟠 LIKELY FAKE - Suspicious content
- 🔴 DEEPFAKE - Likely manipulated
python -m core.image_pipeline --image path/to/image.jpgpython -m core.video_pipeline --video path/to/video.mp4python -m core.live_pipelinePress q to quit
python -m core.screen_pipelinePress Ctrl+C to stop
deepguard/
├── main.py # 🆕 v2 Entry point - overlay mode
├── config.py # 🆕 Centralized configuration
├── requirements.txt # Dependencies
├── README.md # This file
│
├── core/ # Detection engine
│ ├── engine.py # 🆕 v2 Main orchestration
│ ├── confidence.py # 🆕 5-tier classification
│ ├── temporal.py # 🆕 Frame aggregation
│ ├── screen_capture.py # 🆕 Thread-safe screen capture
│ ├── explainer.py # 🆕 Gemini integration
│ ├── detector.py # Core DeepfakeDetector
│ ├── face_detector_mtcnn.py # MTCNN wrapper
│ ├── image_pipeline.py # Image analysis
│ ├── video_pipeline.py # Video processing
│ ├── live_pipeline.py # Webcam detection
│ └── screen_pipeline.py # CLI screen capture
│
├── overlay/ # 🆕 PyQt6 UI
│ ├── __init__.py
│ └── window.py # Floating overlay
│
└── mesonet/ # MesoNet model
├── classifiers.py # Model architecture
└── weights/ # Pre-trained weights
All settings in config.py:
# Capture settings
capture.fps = 10 # Analysis framerate
capture.monitor_index = 1 # Which monitor to capture
# Detection thresholds (probability of FAKE)
confidence.real_high = 0.20 # Below = REAL
confidence.fake_low = 0.65 # Above = DEEPFAKE
# Overlay appearance
overlay.position = "top-right" # Window position
overlay.opacity = 0.92 # Transparency
# Gemini API
gemini.model = "gemini-2.0-flash-exp" # Latest experimental model
gemini.enabled = True📺 Watch the 3-minute demo video
Shows DeepGuard detecting deepfakes across Instagram Reels, YouTube Shorts, and TikTok
| Criteria | Weight | How DeepGuard Addresses It |
|---|---|---|
| Technical Execution | 40% | Working end-to-end pipeline with real-time ML inference, temporal smoothing, and robust error handling |
| Innovation/Wow Factor | 30% | Novel "always-on overlay" approach vs traditional upload-analyze pattern |
| Potential Impact | 20% | Protects against misinformation spread across all social platforms |
| Presentation/Demo | 10% | Clean UI, comprehensive documentation, clear demo video |
- Android App - Mobile deepfake detection
- Browser Extension - Chrome/Firefox integration
- API Service - Detection as a service
- Multi-model Ensemble - Combine multiple detectors
- GPU Acceleration - Faster inference with CUDA
| Library | License | Purpose |
|---|---|---|
| TensorFlow | Apache 2.0 | Deep learning framework |
| PyQt6 | GPL v3 | UI framework |
| MTCNN | MIT | Face detection |
| mss | MIT | Screen capture |
| google-genai | Apache 2.0 | Gemini API client |
Built with ❤️ for the Gemini 3 Hackathon
Apache 2.0 - See LICENSE for details.
🛡️ Stay safe. Stay informed. Stay protected.
DeepGuard v2 - Your real-time shield against deepfakes