BeneKroetz's picture
Update app.py
fd1e84b verified
raw
history blame contribute delete
698 Bytes
import whisper
import gradio as gr
# Load the Whisper model (you can change "base" to "small", "medium", or "large" depending on your needs)
model = whisper.load_model("base")
# Define the transcription function
def transcribe(audio_file):
# Transcribe the audio file using Whisper
result = model.transcribe(audio_file)
return result["text"]
# Gradio Interface for uploading audio and returning the transcription
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(type="filepath"), # Use 'filepath' to get the path to the uploaded file
outputs="text",
title="Whisper Transcription",
description="Upload an audio or video file to transcribe."
)
iface.launch()