Abraham E. Tavarez
commited on
Commit
Β·
3a57cd5
1
Parent(s):
99e6f81
done
Browse files- .env.example +1 -0
- .gitattributes +35 -0
- .gitignore +2 -1
- README.md +150 -3
- requirements.txt +12 -0
.env.example
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ANTHROPIC_API_KEY="sdk-"
|
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
|
@@ -9,4 +9,5 @@ wheels/
|
|
| 9 |
# Virtual environments
|
| 10 |
.venv
|
| 11 |
app.copy.py
|
| 12 |
-
app.audio.tool.py
|
|
|
|
|
|
| 9 |
# Virtual environments
|
| 10 |
.venv
|
| 11 |
app.copy.py
|
| 12 |
+
app.audio.tool.py
|
| 13 |
+
assets/
|
README.md
CHANGED
|
@@ -1,4 +1,151 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: MCP Hackathon Deepfake Watchdog
|
| 3 |
+
emoji: π‘οΈ
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.33.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
short_description: Upload your image and/or voice to scan for deepfake misuse o
|
| 12 |
+
---
|
| 13 |
+
# π‘οΈ Deepfake Watchdog π€
|
| 14 |
|
| 15 |
+
π·οΈ Tags: `mcp-server-track` `agent-demo-track`
|
| 16 |
+
|
| 17 |
+
A multimodal AI agent that detects deepfake content using **face**, **voice**, and **video** verification. Built with π§ DeepFace, π£οΈ SpeechBrain, π₯ OpenCV, and accelerated with βοΈ Modal for serverless GPU-powered execution. Designed for the **MCP HuggingFace's Hackathon**.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## π Features
|
| 24 |
+
|
| 25 |
+
- π§β𦱠**Face Verification**: Compare two faces and detect if they belong to the same person using DeepFace.
|
| 26 |
+
- ποΈ **Voice Verification**: Determine if two audio samples are from the same speaker with SpeechBrain.
|
| 27 |
+
- ποΈ **Video Scan for Deepfakes**: Scan a video (or YouTube link) and match all faces against a reference image.
|
| 28 |
+
- π **PDF Report**: Generate a downloadable report with all scan results.
|
| 29 |
+
- π§ **Runs as an MCP Agent**: Compatible with [Gradio MCP](https://huggingface.co/docs/mcp), fully pluggable into agentic workflows.
|
| 30 |
+
- β‘ **Modal Offloading**: GPU-backed execution for DeepFace & SpeechBrain using [Modal](https://modal.com).
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## π§± Architecture
|
| 35 |
+
|
| 36 |
+
Gradio UI ββ> MCP Agent ββ> Modal Functions
|
| 37 |
+
ββ> verify_faces_remote()
|
| 38 |
+
ββ> verify_voices_remote()
|
| 39 |
+
ββ> verify_faces_in_video_remote()
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## π§© Tech Stack
|
| 45 |
+
|
| 46 |
+
| Tool | Purpose |
|
| 47 |
+
|--------------|----------------------------------|
|
| 48 |
+
| `Gradio` | Frontend UI + MCP integration |
|
| 49 |
+
| `Modal` | GPU offloading for ML workloads |
|
| 50 |
+
| `DeepFace` | Face verification |
|
| 51 |
+
| `SpeechBrain`| Voice verification |
|
| 52 |
+
| `OpenCV` | Video processing |
|
| 53 |
+
| `Pillow` | Image manipulation |
|
| 54 |
+
| `TensorFlow` | Required by DeepFace |
|
| 55 |
+
| `FFmpeg` | (Optional) for YouTube downloads |
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## π οΈ Setup Instructions
|
| 60 |
+
|
| 61 |
+
### 1. Clone the repo
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
git clone https://huggingface.co/spaces/abetavarez/MCP-Hackathon-Deepfake-Watchdog
|
| 65 |
+
cd MCP-Hackathon-Deepfake-Watchdog
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### 2. Create .env
|
| 69 |
+
```bash
|
| 70 |
+
cp .env.example .env
|
| 71 |
+
# Add your API keys or configs if required
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### 3. Install dependencies (locally)
|
| 75 |
+
```bash
|
| 76 |
+
pip install -r requirements.txt
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### 4. Run the app (with MCP)
|
| 80 |
+
```bash
|
| 81 |
+
modal run app.py
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
or for development::
|
| 85 |
+
```bash
|
| 86 |
+
python app.py
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## βοΈ Modal Setup
|
| 90 |
+
The app uses a single modal_app/backend.py file that defines:
|
| 91 |
+
|
| 92 |
+
verify_faces_remote
|
| 93 |
+
|
| 94 |
+
verify_voices_remote
|
| 95 |
+
|
| 96 |
+
verify_faces_in_video_remote
|
| 97 |
+
|
| 98 |
+
Each function is GPU-accelerated and runs independently on demand.
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
modal deploy modal_app.py
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## π§ Agent MCP Integration
|
| 105 |
+
This app runs as an MCP server using:
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
demo.launch(mcp_server=True)
|
| 109 |
+
```
|
| 110 |
+
You can use this tool in your LlamaIndex, Hugging Face or LangChain agent as a remote service.
|
| 111 |
+
|
| 112 |
+
π Hackathon Tracks
|
| 113 |
+
β
Track 1: MCP Tool β Turned into a reusable tool with mcp_server=True
|
| 114 |
+
β
Track 3: Agentic Demo β A fully capable AI agent for deepfake detection (LlamaIndex)
|
| 115 |
+
β
Modal β Offloaded heavy tasks to Modalβs GPU cloud
|
| 116 |
+
|
| 117 |
+
## π§± Folder Structure
|
| 118 |
+
.
|
| 119 |
+
βββ app.py # Main app entry point (Gradio + MCP)
|
| 120 |
+
βββ llama_agent.py # LlamaIndex Agent implementation
|
| 121 |
+
βββ tools.py # Tools for LlamaIndex Agent and MCP
|
| 122 |
+
βββ modal_app/
|
| 123 |
+
β βββ backend.py # Modal remote functions
|
| 124 |
+
βββ detector/
|
| 125 |
+
β βββ face.py # Local face verification logic
|
| 126 |
+
β βββ voice.py # Local voice verification logic
|
| 127 |
+
β βββ video.py # Local video scan logic
|
| 128 |
+
βββ reports/
|
| 129 |
+
β βββ pdf_report.py # PDF report generation
|
| 130 |
+
βββ utils/
|
| 131 |
+
β βββ youtube_utils.py # YouTube download helper
|
| 132 |
+
βββ README.md
|
| 133 |
+
βββ requirements.txt
|
| 134 |
+
βββ .env.example
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
##π§βπ» Author
|
| 138 |
+
Abraham Efren Tavarez
|
| 139 |
+
GitHub - [@AbeTavarez](https://github.com/AbeTavarez)
|
| 140 |
+
LinkedIn β [@abrahametavarez](https://www.linkedin.com/in/abrahametavarez/)
|
| 141 |
+
|
| 142 |
+
## β¨ Future Improvements
|
| 143 |
+
Add S3-compatible cloud storage or video ingest
|
| 144 |
+
|
| 145 |
+
Add Nebius S3 support for video uploads
|
| 146 |
+
|
| 147 |
+
Add RAG-based evidence summarizer
|
| 148 |
+
|
| 149 |
+
Enable auto-scan via background agent
|
| 150 |
+
|
| 151 |
+
Add QR code for mobile voice capture
|
requirements.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
anthropic>=0.53.0
|
| 2 |
+
deepface>=0.0.93
|
| 3 |
+
fpdf>=1.7.2
|
| 4 |
+
gradio[mcp]>=5.32.1
|
| 5 |
+
llama-index>=0.12.41
|
| 6 |
+
llama-index-llms-anthropic>=0.7.2
|
| 7 |
+
modal>=1.0.3
|
| 8 |
+
opencv-python-headless>=4.11.0.86
|
| 9 |
+
pydub>=0.25.1
|
| 10 |
+
resemblyzer>=0.1.4
|
| 11 |
+
tf-keras>=2.19.0
|
| 12 |
+
yt-dlp>=2025.5.22
|