Spaces:
Build error
Build error
| 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 | |