Spaces:
Sleeping
Sleeping
Download app.py from errno98/stream_test: direct link, hf CLI and curl.
- Browser
- Download file 464 Bytes
-
https://huggingface.co/spaces/errno98/stream_test/resolve/main/app.py
- Command line
-
hf download hf://spaces/errno98/stream_test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/errno98/stream_test/resolve/main/app.py
464 Bytes
| from transformers import pipeline | |
| import gradio as gr | |
| import time | |
| p = pipeline("automatic-speech-recognition") | |
| def transcribe(audio, state=""): | |
| time.sleep(1) | |
| text = p(audio)["text"] | |
| state += text + " " | |
| return state, state | |
| gr.Interface( | |
| fn=transcribe, | |
| inputs=[ | |
| gr.Audio(source="microphone", type="filepath", streaming=True), | |
| "state" | |
| ], | |
| outputs=[ | |
| "textbox", | |
| "state" | |
| ], | |
| live=True).launch() | |