Spaces:
Runtime error
Runtime error
File size: 595 Bytes
e7aceea 2b4c43b e7aceea 6d89794 9bf3f26 e7aceea 9bf3f26 e7aceea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import openai
import time
OPENAI_TRANSCRIPTION_MODEL='whisper-1'
openai_client = openai.OpenAI()
def whisper_transcribe(fn, temperature=0):
t0 = time.time()
audio_file = open(fn,'rb') # redundant?
whisper = openai_client.audio.transcriptions.create
transcript = whisper(model=OPENAI_TRANSCRIPTION_MODEL,
file=audio_file, language='es',
temperature=0.0) # to do, explore temperature
dt = round(time.time()-t0,2)
transcript = transcript.text
print(f'Whisper transcribe [dt={dt} secs]')
return transcript
|