CoolFace
Apppublic

papajoikos/pyannote-diarization

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
App README

PyAnnote Speaker Diarization API

Free-tier compatible speaker diarization API using pyannote.audio.

Setup Required

  1. 1.Accept Model Terms: Go to https://huggingface.co/pyannote/speaker-diarization-community and accept the terms
  1. 1.Create HF Token: Get your token at https://huggingface.co/settings/tokens
  1. 1.Add Secret to Space: In your HuggingFace Space settings, add HF_TOKEN as a secret with your token value

API Endpoints

EndpointMethodDescription
/diarizePOSTBasic diarization (returns speaker segments)
/diarize-with-segmentsPOSTDiarization with timestamp alignment (recommended)
/healthGETCheck API and pipeline status
/infoGETModel information

Usage

Basic Diarization

bash
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:

bash
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

json
{
  "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
}