File size: 594 Bytes
c2a79e9
a94ad8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a7f8709
a94ad8d
 
 
 
 
1a03806
a94ad8d
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import torch
import gradio as gr
from transformers import pipeline


pipe = pipeline(
  "automatic-speech-recognition",
  model="openai/whisper-small"
)

def transcribe(input_audio):
    # Perform speech recognition on the input audio
    transcription = asr_pipeline(input_audio)["text"]
    return transcription

gradio_app = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath", label="Record or Upload Audio"),
    outputs=gr.Textbox(label="Transcription"),
    title="Speech to Text Transcription with Whisper",
)

if __name__ == "__main__":
    gradio_app.launch()