Spaces:
Sleeping
Sleeping
| import os | |
| from openai import OpenAI | |
| def transcribe_audio(file_path: str, language: str = "de") -> str: | |
| client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) | |
| with open(file_path, "rb") as f: | |
| resp = client.audio.transcriptions.create( | |
| model="gpt-4o-mini-transcribe", | |
| file=f, | |
| language=language, | |
| ) | |
| return getattr(resp, "text", str(resp)) |