Skip to content

Bad request error #232

Closed Answered by jjmaldonis
samueljazzjohn asked this question in General help
Jun 26, 2023 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

I can't quite tell how audio_file is getting created, but it sounds like it's an io.BytesIO object. An io.BytesIO object cannot be passed to the Deepgram SDK. Instead, you'll need to pass an io.BufferedReader object. Luckily, the conversation is very simple! You can convert it via io.BufferedReader(audio_data).

Below is a synchronous example that demonstrates how this works:

from deepgram import Deepgram
import asyncio
import io
import os


DEEPGRAM_API_KEY = os.environ["DEEPGRAM_API_KEY"]  # Your Deepgram API Key


async def transcribe():
    deepgram = Deepgram(DEEPGRAM_API_KEY)

    # Download the audio from: https://traffic.megaphone.fm/GLT4320773090.mp3
    # `one_each.mp3` is an aud…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@samueljazzjohn
Comment options

@jjmaldonis
Comment options

Answer selected by samueljazzjohn
Comment options

You must be logged in to vote
1 reply
@jjmaldonis
Comment options

Comment options

You must be logged in to vote
1 reply
@jjmaldonis
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants