This project implements a robust REST API for detecting AI-generated voice samples. It uses an Ensemble of 3 State-of-the-Art Deep Learning Models to achieve high accuracy and provide detailed explanations.
- Ensemble Detection: Combines predictions from 3 different Hugging Face models.
- Dynamic Explanations: Provides context-aware reasons for classification.
- Format Support: Accepts Base64 encoded MP3 files.
- Language Support: Optimized for Tamil, English, Hindi, Malayalam, Telugu.
- Python 3.8+
ffmpeg(Required for audio processing)
-
Install System Dependencies (Linux/Ubuntu):
sudo apt update && sudo apt install ffmpeg -y -
Install Python Dependencies:
pip install -r requirements.txt
Start the FastAPI server using uvicorn:
uvicorn app:app --host 0.0.0.0 --port 8000 --reloadThe server will start at http://localhost:8000.
We have provided a script test_api.py that automatically finds all .mp3 files in the current directory and tests them against the API.
python3 test_api.pyYou can verify the API manually using curl:
curl -X POST http://localhost:8000/api/voice-detection \
-H "Content-Type: application/json" \
-H "x-api-key: AI_DETECT" \
-d '{
"language": "English",
"audioFormat": "mp3",
"audioBase64": "<YOUR_BASE64_STRING_HERE>"
}'Once the server is running, you can access the interactive API docs at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc