Spaces:
Sleeping
Sleeping
import gradio as gr | |
import openai | |
import os | |
openai.api_key = os.getenv("OPENAI_API_KEY") | |
def transcribe_audio(file): | |
transcript = openai.Audio.transcribe("whisper-1", file) | |
return transcript.text.strip() | |
def translate_audio(file): | |
transcript = openai.Audio.translate("whisper-1", file) | |
return transcript.text.strip() | |
audio_input = gr.inputs.Audio(label="Upload Audio File") | |
output_text = gr.outputs.Textbox(label="Transcribed Text") | |
interface = gr.Interface(fn=transcribe_audio, inputs=audio_input, outputs=output_text) | |
interface.launch() | |