Translate Streaming STT Transcripts with LeMUR
In this guide, you’ll learn how to implement real-time translation using AssemblyAI’s Streaming model and LeMUR framework.
Quickstart
Step-by-Step Instructions
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for a free account and get your API key from your dashboard. Please note that this feature is available for paid accounts only. If you’re on the free plan, you’ll need to upgrade.
Install the AssemblyAI Python SDK. To use the microphone stream, you need to install the extras for this SDK. Mac and Linux users also need to install portaudio
before installing the extras.
Import the assemblyai
package and set the API key.
Create functions to handle different events during transcription.
In our on_data
function, we’re going to call LeMUR to perform real-time translation using the Claude 3 Haiku model. Other models work just as well (if not better, in the case of 3.5 Sonnet), but Haiku has proven to be the fastest at translation tasks. Note that LeMUR does only officially support English, so your mileage may vary with how well the translations turn out.
Create a RealtimeTranscriber
to set up the Streaming STT configuration.
Begin the Streaming STT transcription process.