papajoikos/pyannote-diarization
0
PyAnnote Speaker Diarization API
Free-tier compatible speaker diarization API using pyannote.audio.
Setup Required
- Accept Model Terms: Go to https://huggingface.co/pyannote/speaker-diarization-community and accept the terms
- Create HF Token: Get your token at https://huggingface.co/settings/tokens
- Add Secret to Space: In your HuggingFace Space settings, add
HF_TOKENas a secret with your token value
API Endpoints
Usage
Basic Diarization
curl -X POST "https://your-space.hf.space/diarize" \
-F "audio=@audio.wav" \
-F "min_speakers=1" \
-F "max_speakers=10"Diarization with Transcription Segments (Recommended)
Use this endpoint to align PyAnnote speaker timestamps with Groq/Whisper transcription timestamps:
curl -X POST "https://your-space.hf.space/diarize-with-segments" \
-F "audio=@audio.wav" \
-F "segments=[{\"start\": 0.0, \"end\": 5.2, \"text\": \"Hello world\"}, {\"start\": 5.2, \"end\": 10.5, \"text\": \"How are you\"}]"Response Format
{
"segments": [
{"start": 0.0, "end": 5.2, "text": "Hello world", "speaker": "SPEAKER_00"},
{"start": 5.2, "end": 10.5, "text": "How are you", "speaker": "SPEAKER_01"}
],
"duration": 120.5,
"speakers": ["SPEAKER_00", "SPEAKER_01"],
"num_speakers": 2
}