Spaces:
Sleeping
Sleeping
File size: 413 Bytes
6cc9795 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
client = OpenAI(api_key=os.getenv("openai_api_key"))
def transcribe_audio(audio_file):
with open(audio_file, "rb") as audio_file:
transcription = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file,
response_format="text"
)
return transcription
|