Download app.py from mayora182/audio: direct link, hf CLI and curl.
- Browser
- Download file 626 Bytes
-
https://huggingface.co/spaces/mayora182/audio/resolve/main/app.py
- Command line
-
hf download hf://spaces/mayora182/audio/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mayora182/audio/resolve/main/app.py
626 Bytes
| # Let's get pipelines from transformers | |
| from transformers import pipeline | |
| # Let's import Gradio | |
| import gradio as gr | |
| # Let's set up the model | |
| model = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-spanish") | |
| title = "Audio2Text" | |
| description = "Record your audio in Spanish and send it in order to received a transcription" | |
| # Function | |
| def transcribe(audio): | |
| # Let's invoke "model" defined above | |
| text = model(audio)["text"] | |
| return text | |
| # Interface Set-Up | |
| gr.Interface( | |
| fn=transcribe, | |
| inputs=[gr.Audio(sources=["microphone"], type="filepath")], | |
| outputs=["textbox"] | |
| ).launch() |