nishchandel commited on
Commit
31b3439
·
1 Parent(s): 60efa5a

Updated readme with proper configs

Browse files
Files changed (1) hide show
  1. README.md +30 -217
README.md CHANGED
@@ -1,226 +1,39 @@
1
- # DeepDefend
 
 
 
 
 
 
 
 
 
 
2
 
3
- > **Multi-Modal Deepfake Detection System**
4
- > Detect AI-generated deepfakes in videos using computer vision and audio analysis
5
 
6
- [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
7
- [![FastAPI](https://img.shields.io/badge/FastAPI-0.109.0-009688.svg)](https://fastapi.tiangolo.com)
8
 
9
- ## Overview
10
 
11
- DeepDefend is a comprehensive deepfake detection system that combines **video frame analysis** and **audio analysis** to identify AI-generated synthetic media. Using machine learning models and AI-powered evidence fusion, it provides detailed, interval-by-interval analysis with explainable results.
 
 
 
12
 
13
- ### Why DeepDefend?
14
 
15
- - **Multi-Modal Analysis**: Combines video and audio detection for higher accuracy
16
- - **AI-Powered Fusion**: Uses LLM to generate human-readable reports
17
- - **Interval Breakdown**: Shows exactly which parts of the video are suspicious
18
- - **REST API**: Easy integration with any frontend or application
19
 
20
- ## Features
 
 
 
21
 
22
- ### Core Detection Capabilities
 
23
 
24
- - **Video Analysis**
25
- - Frame-by-frame deepfake detection using pre-trained models
26
- - Face detection and region-specific analysis
27
- - Suspicious region identification (eyes, mouth, face boundaries)
28
- - Confidence scoring per frame
29
-
30
- - **Audio Analysis**
31
- - Voice synthesis detection
32
- - Spectrogram analysis for audio artifacts
33
- - Frequency pattern recognition
34
- - Audio splicing detection
35
-
36
- - **AI-Powered Reporting**
37
- - LLM-based evidence fusion (Google Gemini)
38
- - Natural language explanation of findings
39
- - Verdict with confidence percentage
40
- - Timestamped suspicious intervals
41
-
42
- ### Processing Pipeline
43
-
44
- ```
45
- Video Input
46
-
47
- ┌───────────────────┐
48
- │ Media Extraction │ → Extract frames (5 per interval)
49
- │ │ → Extract audio chunks
50
- └────────┬──────────┘
51
-
52
- ├──────────────────────┬──────────────────────┐
53
- ▼ ▼ ▼
54
- ┌─────────────────┐ ┌─────────────────┐ ┌────────────────┐
55
- │ Video Analysis │ │ Audio Analysis │ │ Timeline Gen │
56
- │ • Face detect │ │ • Spectrogram │ │ • 2s intervals │
57
- │ • Region scan │ │ • Voice synth │ │ • Metadata │
58
- │ • Fake score │ │ • Artifacts │ │ │
59
- └────────┬────────┘ └────────┬────────┘ └────────┬───────┘
60
- │ │ │
61
- └──────────────┬──────────────┬─────────────┘
62
- ▼ ▼
63
- ┌──────────────────────────┐
64
- │ LLM Fusion Engine │
65
- │ • Combine evidence │
66
- │ • Generate verdict │
67
- │ • Natural language report│
68
- └────────────┬─────────────┘
69
-
70
- Final Report
71
- (JSON Response)
72
- ```
73
-
74
- ## Demo
75
-
76
- ### Live Demo
77
- **API**: [https://deepdefend-api.hf.space](https://deepdefend-api.hf.space)
78
- **Docs**: [https://deepdefend-api.hf.space/docs](https://deepdefend-api.hf.space/docs)
79
-
80
- ### Example Analysis
81
-
82
- <details>
83
- <summary>Click to see sample output</summary>
84
-
85
- ```json
86
- {
87
- "verdict": "DEEPFAKE",
88
- "confidence": 87.5,
89
- "overall_scores": {
90
- "overall_video_score": 0.823,
91
- "overall_audio_score": 0.756,
92
- "overall_combined_score": 0.789
93
- },
94
- "detailed_analysis": "This video shows strong indicators of deepfake manipulation...",
95
- "suspicious_intervals": [
96
- {
97
- "interval": "4.0-6.0",
98
- "video_score": 0.891,
99
- "audio_score": 0.834,
100
- "video_regions": ["eyes", "mouth"],
101
- "audio_regions": ["voice_synthesis_artifacts"]
102
- }
103
- ],
104
- "total_intervals_analyzed": 15,
105
- "video_info": {
106
- "duration": 12.498711111111112,
107
- "fps": 29.923085402583734,
108
- "total_frames": 374,
109
- "file_size_mb": 31.36
110
- },
111
- "analysis_id": "4cd98ea5-8c14-4cae-8da4-689345b0aabc",
112
- "timestamp": "2025-10-10T23:34:35.724916"
113
- }
114
- ```
115
- </details>
116
-
117
- ## Installation
118
-
119
- ### Prerequisites
120
-
121
- - Python 3.10 or higher
122
- - FFmpeg installed on your system
123
- - Google Gemini API key
124
-
125
- ### Local Setup
126
-
127
- 1. **Clone the repository**
128
- ```bash
129
- git clone https://github.com/yourusername/deepdefend.git
130
- ```
131
-
132
- 2. **Create virtual environment**
133
- ```bash
134
- python -m venv venv
135
-
136
- # On Linux/Mac
137
- source venv/bin/activate
138
-
139
- # On Windows
140
- venv\Scripts\activate
141
- ```
142
-
143
- 3. **Install dependencies**
144
- ```bash
145
- pip install -r requirements.txt
146
- ```
147
-
148
- 4. **Download ML models**
149
- ```bash
150
- python models/download_model.py
151
- ```
152
- *This will download ~2GB of models from Hugging Face*
153
-
154
- 5. **Configure environment**
155
- ```bash
156
- cp .env.example .env
157
- # Edit .env and add your GOOGLE_API_KEY
158
- ```
159
-
160
- 6. **Run the server**
161
- ```bash
162
- uvicorn main:app --reload
163
- ```
164
-
165
- The API will be available at `http://127.0.0.1:8000`
166
-
167
- ### Docker Setup
168
-
169
- ```bash
170
- # Build image
171
- docker build -t deepdefend .
172
-
173
- # Run container
174
- docker run -p 8000:8000 -e GOOGLE_API_KEY=your_key deepdefend
175
- ```
176
-
177
- ## Tech Stack
178
-
179
- ### Backend
180
- - **Framework**: FastAPI 0.109.0
181
- - **Server**: Uvicorn
182
- - **ML Framework**: PyTorch 2.3.1
183
- - **Transformers**: Hugging Face Transformers 4.36.2
184
-
185
- ### ML Models
186
- - **Video Detection**: [dima806/deepfake_vs_real_image_detection](https://huggingface.co/dima806/deepfake_vs_real_image_detection)
187
- - **Audio Detection**: [mo-thecreator/Deepfake-audio-detection](https://huggingface.co/mo-thecreator/Deepfake-audio-detection)
188
- - **LLM Fusion**: Google Gemini 2.5 Flash
189
-
190
- ### Processing
191
- - **Computer Vision**: OpenCV, Pillow
192
- - **Audio Processing**: Librosa, SoundFile
193
- - **Video Processing**: FFmpeg
194
-
195
- ### Deployment
196
- - **Container**: Docker
197
- - **Platforms**: Hugging Face Spaces
198
-
199
- ## Project Structure
200
-
201
- ```
202
- deepdefend/
203
-
204
- │── extraction/
205
- │ ├── media_extractor.py # Frame & audio extraction
206
- │ └── timeline_generator.py # Timeline creation
207
-
208
- │── analysis/
209
- │ ├── video_analyser.py # Video deepfake detection
210
- │ ├── audio_analyser.py # Audio deepfake detection
211
- │ ├── llm_analyser.py # LLM-based fusion
212
- │ └── prompt.py # LLM prompts
213
-
214
- │── models/
215
- │ ├── download_model.py # Model downloader
216
- │ ├── load_models.py # Model loader
217
- │ ├── video_model/ # (Downloaded)
218
- │ └── audio_model/ # (Downloaded)
219
-
220
- │── main.py # FastAPI application
221
- │── pipeline.py # Main detection pipeline
222
- │── requirements.txt # Python dependencies
223
- │── Dockerfile # Container configuration
224
- ├── .gitignore
225
- └── README.md
226
- ```
 
1
+ # In your local folder, update README.md
2
+ @"
3
+ ---
4
+ title: DeepDefend API
5
+ emoji: 🛡️
6
+ colorFrom: red
7
+ colorTo: blue
8
+ sdk: docker
9
+ app_port: 7860
10
+ pinned: false
11
+ ---
12
 
13
+ # 🛡️ DeepDefend API
 
14
 
15
+ Advanced Multi-Modal Deepfake Detection System
 
16
 
17
+ ## API Endpoints
18
 
19
+ - POST /api/analyze - Analyze video for deepfakes
20
+ - GET /api/health - Health check
21
+ - GET /api/stats - Statistics
22
+ - GET /docs - Interactive API documentation
23
 
24
+ ## Usage
25
 
26
+ Upload a video file to analyze:
 
 
 
27
 
28
+ \`\`\`bash
29
+ curl -X POST "https://nishchandel-deepdefend-api.hf.space/api/analyze" \\
30
+ -F "file=@video.mp4"
31
+ \`\`\`
32
 
33
+ Visit /docs for interactive documentation.
34
+ "@ | Out-File -FilePath README.md -Encoding utf8
35
 
36
+ # Commit and push
37
+ git add README.md
38
+ git commit -m "Fix README configuration"
39
+ git push space main