demo1 / app.py
usha87's picture
Update app.py
1a03806 verified
raw
history blame contribute delete
No virus
594 Bytes
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()