Create Subtitles with Speaker Labels
Quickstart
This Colab will demonstrate how to use AssemblyAI’s Speaker Diarization model together to format subtitles according to their respective speaker.
Step-by-step guide
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an AssemblyAI account and get your API key from your dashboard.
First, we will configure our API key as well as our file to be transcribed. Then, we decide on a number of words we want to have per subtitle.
Lastly, we transcribe our file.
How the code works
speaker_colors
is a dictionary that maps speaker identifiers (like “A”, “B”, “C”, etc.) to specific colors. Each speaker in the transcription will be associated with a unique color in the subtitles.
When Speaker Diarization is enabled, sentences in our API response have a speaker code under the speaker
key. We use the speaker code to determine the color of the subtitle text.
Our last step is to generate and save our subtitle file!