Spaces:
Sleeping
Sleeping
| # -*- coding: utf-8 -*- | |
| import gradio as gr | |
| from transformers import pipeline | |
| asr = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-100h") | |
| def transcribe_audio(audio): | |
| text = asr(audio)["text"] | |
| return text | |
| demo = gr.Interface( | |
| fn=transcribe_audio, | |
| inputs=gr.Audio(sources=["microphone"], type="filepath"), | |
| outputs="text", | |
| title="Speech-to-Text Transcription", | |
| description="Record your voice and get the transcribed text using a pre-trained Wav2Vec2 model." | |
| ) | |
| demo.launch(share=True) | |