Spaces:
Sleeping
Sleeping
File size: 713 Bytes
5b1aa18 138ec1e 5b1aa18 138ec1e 5b1aa18 138ec1e 5b1aa18 138ec1e 5b1aa18 138ec1e 5b1aa18 138ec1e 5b1aa18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
# Load Wav2Vec 2.0 speech recognition model
asr = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
# Function to process audio and return transcribed text
def transcribe(audio):
if audio is None:
return "No audio provided."
return asr(audio)["text"]
# Gradio Interface
interface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(type="filepath", label="Upload or Record Audio"),
outputs=gr.Textbox(label="Transcribed Text"),
title="🎤 Wav2Vec 2.0 - Speech to Text",
description="Upload or record an audio file and get the transcribed text using Facebook's Wav2Vec 2.0."
)
interface.launch()
|