Hi everyone! when i introduce this command i keep receiving the same error:
from openai import OpenAI
client = OpenAI()
audio_file= open(“C:/Users/rgasq/Desktop/HPB/prueba.mp3”, “rb”)
transcript = client.audio.transcriptions.create(
model=“whisper-1”,
file=audio_file
)
SyntaxError: multiple statements found while compiling a single statement
I’ve checked every possible way and i can’t run it.
Thanks a lot!
import os
from openai import OpenAI
client = OpenAI()
audio_file = open("audio.mp3", "rb")
transcription = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file,
response_format="json", # only json supported by Python
prompt=" welcome to my talk.",
language="en",
temperature=0)
# some examples of how to retrieve from transcription object
audio_json = transcription.model_dump()
plain_text = audio_json.get('text')
print(transcription.dict()['text'])