File size: 857 Bytes
2459bb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import whisper

# Load the Whisper model (you can change to "base", "small", "medium", etc.)
model = whisper.load_model("base")

# Function to process the audio file and transcribe
def transcribe_audio(audio):
    # Transcribe the audio using Whisper
    result = model.transcribe(audio)
    return result['text']

# Create a Gradio interface for audio transcription
iface = gr.Interface(
    fn=transcribe_audio,                # The function that will process the audio
    inputs=gr.Audio(source="upload", type="filepath"),  # Upload audio input
    outputs="text",                     # Output transcription as text
    title="Whisper Audio Transcription",  # Title of the interface
    description="Upload an audio file and get the transcription using OpenAI's Whisper model." # Description
)

# Launch the interface
iface.launch()