Update app.py
Browse files
app.py
CHANGED
|
@@ -54,6 +54,7 @@ def recognize(audio: tuple[int, np.ndarray], models, language):
|
|
| 54 |
results = []
|
| 55 |
for name, model in models.items():
|
| 56 |
if length > 20 and name == "alphacep/vosk-model-small-ru":
|
|
|
|
| 57 |
continue
|
| 58 |
start = timer()
|
| 59 |
result = model.recognize(waveform, sample_rate=sample_rate, language=language)
|
|
@@ -110,7 +111,7 @@ with gr.Blocks() as recognize_short:
|
|
| 110 |
|
| 111 |
|
| 112 |
with gr.Blocks() as recognize_long:
|
| 113 |
-
gr.Markdown("For
|
| 114 |
name = gr.Dropdown(models_vad.keys(), label="Model")
|
| 115 |
audio = gr.Audio(min_length=1, max_length=300)
|
| 116 |
with gr.Row():
|
|
@@ -135,6 +136,13 @@ with gr.Blocks(title="onnx-asr demo") as demo:
|
|
| 135 |
# ASR demo using onnx-asr
|
| 136 |
**[onnx-asr](https://github.com/istupakov/onnx-asr)** is a Python package for Automatic Speech Recognition using ONNX models.
|
| 137 |
The package is written in pure Python with minimal dependencies (no `pytorch` or `transformers`).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
""")
|
| 139 |
gr.TabbedInterface(
|
| 140 |
[recognize_short, recognize_long],
|
|
|
|
| 54 |
results = []
|
| 55 |
for name, model in models.items():
|
| 56 |
if length > 20 and name == "alphacep/vosk-model-small-ru":
|
| 57 |
+
gr.Warning(f"Model {name} only supports audio no longer than 20 s.")
|
| 58 |
continue
|
| 59 |
start = timer()
|
| 60 |
result = model.recognize(waveform, sample_rate=sample_rate, language=language)
|
|
|
|
| 111 |
|
| 112 |
|
| 113 |
with gr.Blocks() as recognize_long:
|
| 114 |
+
gr.Markdown("The default VAD parameters are used. For best results, you should adjust the VAD parameters in your app.")
|
| 115 |
name = gr.Dropdown(models_vad.keys(), label="Model")
|
| 116 |
audio = gr.Audio(min_length=1, max_length=300)
|
| 117 |
with gr.Row():
|
|
|
|
| 136 |
# ASR demo using onnx-asr
|
| 137 |
**[onnx-asr](https://github.com/istupakov/onnx-asr)** is a Python package for Automatic Speech Recognition using ONNX models.
|
| 138 |
The package is written in pure Python with minimal dependencies (no `pytorch` or `transformers`).
|
| 139 |
+
|
| 140 |
+
**onnx-asr** is very easy to use (see [Readme](https://github.com/istupakov/onnx-asr?tab=readme-ov-file) for more examples):
|
| 141 |
+
```py
|
| 142 |
+
import onnx_asr
|
| 143 |
+
model = onnx_asr.load_model("nemo-parakeet-tdt-0.6b-v2")
|
| 144 |
+
print(model.recognize("test.wav"))
|
| 145 |
+
```
|
| 146 |
""")
|
| 147 |
gr.TabbedInterface(
|
| 148 |
[recognize_short, recognize_long],
|