Spaces:
Sleeping
Sleeping
Rasmus Aagaard
commited on
Commit
·
4f087e6
1
Parent(s):
7b1e8ff
add app files
Browse files- app.py +26 -0
- packages.txt +1 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import nemo.collections.asr as nemo_asr
|
| 3 |
+
|
| 4 |
+
asr_model = nemo_asr.models.ASRModel.from_pretrained(
|
| 5 |
+
model_name="nvidia/parakeet-rnnt-110m-da-dk"
|
| 6 |
+
)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def transcribe_audio(audio):
|
| 10 |
+
transcription = asr_model.transcribe([audio])
|
| 11 |
+
return transcription[0].text if transcription else "No transcription available."
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown(
|
| 16 |
+
"""# [Parakeet-RNNT-110M-Danish](https://huggingface.co/nvidia/parakeet-rnnt-110m-da-dk) Speech-to-Text Transcription Demo"""
|
| 17 |
+
)
|
| 18 |
+
audio_input = gr.Audio(type="filepath", label="Record or upload your audio")
|
| 19 |
+
transcribe_button = gr.Button("Transcribe")
|
| 20 |
+
transcription_output = gr.Textbox(label="Transcription")
|
| 21 |
+
|
| 22 |
+
transcribe_button.click(
|
| 23 |
+
fn=transcribe_audio, inputs=audio_input, outputs=transcription_output
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
demo.launch()
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
nemo-toolkit[asr]>=1.23.0
|