Spaces:
Runtime error
Runtime error
Download app.py from dev427tools/TTSApp1: direct link, hf CLI and curl.
- Browser
- Download file 894 Bytes
-
https://huggingface.co/spaces/dev427tools/TTSApp1/resolve/main/app.py
- Command line
-
hf download hf://spaces/dev427tools/TTSApp1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/dev427tools/TTSApp1/resolve/main/app.py
894 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the Automatic Speech Recognition pipeline from Hugging Face | |
| asr = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3") | |
| def transcribe(audio): | |
| if audio is None: | |
| return "Please record or upload an audio file." | |
| # audio is a tuple: (sample_rate, numpy array) | |
| result = asr(audio)["text"] | |
| return result | |
| description = """ | |
| # Speech-to-Text Converter | |
| Record your voice or upload an audio file and get the transcription using Hugging Face's Whisper model. | |
| """ | |
| demo = gr.Interface( | |
| fn=transcribe, | |
| inputs=gr.Audio(source="microphone", type="numpy", label="Record or Upload Audio"), | |
| outputs=gr.Textbox(label="Transcribed Text"), | |
| title="Speech to Text App", | |
| description=description, | |
| allow_flagging="never", | |
| theme="default" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |