def transcribe(self, request):
# ...The rest of the data loading is too much to fit here
# check out this repo to see the full implementation!
# Initialize Configuration and retrieve the API key
config = Configuration()
assembly_api_key = config.get("ASSEMBLY_AI_API_KEY")
# Request transcription
headers = {
"authorization": assembly_api_key,
"content-type": "application/json"
}
transcript_request = {
"audio": audio_data,
"wait": True
}
response = requests.post(
f"{self.assembly_api_url}/transcript", \
json=transcript_request, \
headers=headers
)