Whisper-API / app.py
Lenylvt's picture
Update app.py
30d58a1 verified
raw
history blame
704 Bytes
import gradio as gr
import whisper
# Load the Whisper model
model = whisper.load_model("base")
def transcribe(audio_file):
# Process the audio file directly with the file path
result = model.transcribe(audio_file)
# Return the transcription
return result['text']
# Create the Gradio interface
iface = gr.Interface(fn=transcribe,
inputs=gr.inputs.Audio(sources="upload", type="file", label="Upload Audio"),
outputs="text",
title="Whisper Transcription",
description="Upload an audio file to transcribe it using OpenAI's Whisper model.")
# Launch the app
if __name__ == "__main__":
iface.launch()