Credentials. Keep your Hugging Face token in an environment variable rather than hard coded in scripts.
privacy. Speaker analysis of recordings of other people needs their consent.
Who it is forA developer adding speaker labels to transcripts.
The problemTranscripts without speaker turns are hard to read and analyze.
The outcomeA list of turns like start=0.2s stop=1.5s speaker_0.
What you need first
- ffmpeg installed (needed by torchcodec audio decoding)
- Python with `pip install pyannote.audio` or `uv add pyannote.audio`
- A Hugging Face access token and accepted user conditions for pyannote/speaker-diarization-community-1; a GPU is optional
Steps
- Install ffmpeg, then
pip install pyannote.audio - Accept the pyannote/speaker-diarization-community-1 user conditions and create a Hugging Face access token
- Load the pipeline with Pipeline.from_pretrained("pyannote/speaker-diarization-community-1", token=...) as in the README
- Send it to the GPU when available, run it on audio.wav with a ProgressHook, and loop over output.speaker_diarization to print turns
Prompt for your agent
Using pyannote/pyannote-audio, write a script that loads speaker-diarization-community-1 with my HF token from an environment variable, runs it on <my audio file> with ProgressHook, and saves the turns to a CSV.
Caveat. Speaker labels are anonymous per file; mapping them to real names is up to you.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for pyannote/pyannote-audio and "Find who spoke when, locally"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer