File size: 540 Bytes
bb7408d
 
 
bc3d280
 
bb7408d
bc3d280
bb7408d
bc3d280
bb7408d
bc3d280
 
bb7408d
bc3d280
bb7408d
bc3d280
 
bb7408d
 
 
bc3d280
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from transformers import pipeline

# Load Whisper ASR pipeline
asr = pipeline("automatic-speech-recognition", model="openai/whisper-base")

# Transcription function
def transcribe(audio):
    return asr(audio)["text"]

# Gradio interface
interface = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath", label="Upload or Record Audio"),
    outputs="text",
    title="Whisper ASR Voice Recognition",
    description="Transcribe speech using OpenAI's Whisper model."
)

# Launch the app
interface.launch()