🚀 FastDiarize is a lightweight and efficient speaker diarization API powered by FastAPI and Pyannote.audio. It enables automatic speaker segmentation in audio files using AI.
docker run -d --gpus all -p 8000:8000 -e HUGGINGFACE_TOKEN="your_huggingface_token" lumymedia/fastdiarize:latest💠 No installation needed! The API is instantly available at http://localhost:8000.
Send a POST request to the /analyze endpoint with a publicly accessible MP3 URL:
curl -X 'POST' 'http://localhost:8000/analyze' \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com/audio.mp3"}'The API returns timestamps for each speaker in the following format:
{
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"segments": [
{"speaker": "SPEAKER_1", "start": 0.00, "end": 3.50},
{"speaker": "SPEAKER_2", "start": 3.51, "end": 7.80}
]
}request_id: A unique ID for the request.segments: A list of speaker segments with start and end times in seconds.
Before using FastDiarize, ensure you have the following:
- Hugging Face API token: Required to load the Pyannote.audio pipeline. Get your token here.
- Docker (optional but recommended): For easy deployment.
- Python 3.8+: If running manually.
FastDiarize is designed to be lightweight and easy to use, but here are a few things to keep in mind:
- The audio file must be publicly accessible via a URL.
- Currently, only MP3 files are supported.
- For best results, audio should be at least 1 second long.
- Longer files may take more time to process.
Want to help improve these features? Pull requests are welcome! 🚀
- The API automatically uses GPU acceleration if available.
- Processing time depends on the length of the audio file.
- For optimal performance, ensure your system has a compatible GPU.
Here are some common errors and how to resolve them:
- 408 Timeout: The audio download took too long. Check the URL and try again.
- 400 Bad Request: The audio file is invalid, too short, or inaccessible.
- 500 Internal Server Error: An unexpected error occurred during analysis. Check the logs for details.
If you prefer to run the API manually:
git clone https://github.com/lumymedia/FastDiarize.git
cd FastDiarizepip install -r requirements.txtCreate a .env file and add:
HUGGINGFACE_TOKEN=your_huggingface_token
uvicorn main:app --host 0.0.0.0 --port 8000For a fully managed deployment, use Docker Compose:
docker-compose up -dWant to improve FastDiarize? Contributions are welcome!
1️⃣ Fork the repo & create a new branch
2️⃣ Make changes & commit
3️⃣ Open a Pull Request
FastDiarize is released under the MIT License.
🌟 If you find this project useful, give it a star on GitHub! 🚀