bakshia commited on
Commit
9c35442
Β·
1 Parent(s): 294a97e

Add Hugging Face Spaces deployment configuration

Browse files
Files changed (2) hide show
  1. Dockerfile +22 -0
  2. README.md +19 -104
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies for audio processing
6
+ RUN apt-get update && apt-get install -y \
7
+ ffmpeg \
8
+ libsndfile1 \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy requirements first for caching
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ # Copy application code
16
+ COPY . .
17
+
18
+ # Expose port 7860 (HuggingFace Spaces default)
19
+ EXPOSE 7860
20
+
21
+ # Run the application
22
+ CMD ["python", "run.py", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,112 +1,27 @@
1
- # AI Voice Detection API
 
 
 
 
 
 
 
 
2
 
3
- Detect AI-generated voices across multiple languages with NVIDIA PersonaPlex detection.
4
 
5
- ## Features
6
 
7
- - 🎯 **Multi-Model Detection**: Ensemble of Wav2Vec2, CNN, and signature analysis
8
- - 🌐 **Multi-Language Support**: Tamil, English, Hindi, Malayalam, Telugu
9
- - πŸ” **AI Tool Detection**: Identifies NVIDIA PersonaPlex, ElevenLabs, Azure TTS, Google WaveNet
10
- - πŸ“Š **Detailed Explanations**: Technical analysis with confidence scores
11
 
12
- ## Quick Start
 
 
13
 
14
- ### 1. Install Dependencies
15
 
16
  ```bash
17
- pip install -r requirements.txt
18
- ```
19
-
20
- ### 2. Run the Server
21
-
22
- ```bash
23
- # Development mode with auto-reload
24
- python run.py --reload
25
-
26
- # Or directly with uvicorn
27
- uvicorn app.main:app --reload --port 8000
28
- ```
29
-
30
- ### 3. Test the API
31
-
32
- Open http://localhost:8000/docs for the interactive Swagger UI.
33
-
34
- ## API Usage
35
-
36
- ### Detect AI Voice
37
-
38
- **Endpoint:** `POST /api/v1/detect`
39
-
40
- **Request:**
41
- ```json
42
- {
43
- "audio_base64": "<Base64-encoded MP3 audio>",
44
- "language_hint": "en"
45
- }
46
- ```
47
-
48
- **Response:**
49
- ```json
50
- {
51
- "classification": "ai_generated",
52
- "confidence": 0.92,
53
- "ai_probability": 0.92,
54
- "human_probability": 0.08,
55
- "ai_tool_detected": "NVIDIA PersonaPlex/Riva",
56
- "explanation": {
57
- "summary": "Strong evidence of AI-generated voice detected",
58
- "confidence_level": "high",
59
- "technical_details": {
60
- "spectral_artifacts": ["Vocoder artifacts in 6-8kHz"],
61
- "temporal_patterns": ["Low temporal variation"],
62
- "synthesis_markers": ["HiFi-GAN fingerprint"]
63
- },
64
- "key_indicators": [
65
- "Signature matches NVIDIA PersonaPlex/Riva",
66
- "Phase coherence matches HiFi-GAN pattern"
67
- ]
68
- }
69
- }
70
  ```
71
-
72
- ## Detection Methods
73
-
74
- | Method | Weight | Description |
75
- |--------|--------|-------------|
76
- | IndicWav2Vec | 45% | Deep acoustic patterns using Indian language models |
77
- | Spectrogram CNN | 35% | Visual artifact detection in mel spectrograms |
78
- | PersonaPlex Detector | 20% | AI tool signature matching |
79
-
80
- ## Supported Languages
81
-
82
- | Code | Language |
83
- |------|----------|
84
- | ta | Tamil |
85
- | en | English |
86
- | hi | Hindi |
87
- | ml | Malayalam |
88
- | te | Telugu |
89
-
90
- ## Project Structure
91
-
92
- ```
93
- hackathon1/
94
- β”œβ”€β”€ app/
95
- β”‚ β”œβ”€β”€ main.py # FastAPI application
96
- β”‚ β”œβ”€β”€ config.py # Configuration
97
- β”‚ β”œβ”€β”€ api/
98
- β”‚ β”‚ β”œβ”€β”€ routes.py # API endpoints
99
- β”‚ β”‚ └── schemas.py # Pydantic models
100
- β”‚ └── models/
101
- β”‚ β”œβ”€β”€ wav2vec_detector.py # IndicWav2Vec detector
102
- β”‚ β”œβ”€β”€ spectrogram_cnn.py # CNN classifier
103
- β”‚ β”œβ”€β”€ personaplex_detector.py # AI tool detection
104
- β”‚ └── ensemble_detector.py # Ensemble fusion
105
- β”œβ”€β”€ requirements.txt
106
- β”œβ”€β”€ run.py # Server entry point
107
- └── README.md
108
- ```
109
-
110
- ## License
111
-
112
- MIT License
 
1
+ ---
2
+ title: AI Voice Detection API
3
+ emoji: 🎀
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ ---
10
 
11
+ # AI Voice Detection API
12
 
13
+ Detect AI-generated voices using advanced acoustic analysis and neural network patterns.
14
 
15
+ ## API Endpoints
 
 
 
16
 
17
+ - `POST /api/v1/detect` - Detect if audio is AI-generated
18
+ - `GET /api/v1/health` - Health check
19
+ - `GET /docs` - API documentation
20
 
21
+ ## Usage
22
 
23
  ```bash
24
+ curl -X POST "https://YOUR-SPACE.hf.space/api/v1/detect" \
25
+ -H "Content-Type: application/json" \
26
+ -d '{"audioUrl": "https://example.com/audio.mp3"}'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ```