Spaces:
Runtime error
Runtime error
nguyenanh2803
commited on
Commit
•
547a76d
1
Parent(s):
0d3c251
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import nemo.collections.asr as nemo_asr
|
3 |
+
|
4 |
+
# Load the pretrained model
|
5 |
+
conformer_large = nemo_asr.models.ASRModel.from_pretrained("nguyenanh2803/stt_conformer_large_na")
|
6 |
+
|
7 |
+
# Define the transcription function
|
8 |
+
def transcribe_audio(audio):
|
9 |
+
# audio is a tuple of (sample_rate, audio_data)
|
10 |
+
sample_rate, audio_data = audio
|
11 |
+
# Transcribe the audio file
|
12 |
+
transcription = conformer_large.transcribe([audio_data])
|
13 |
+
return transcription[0]
|
14 |
+
|
15 |
+
# Create the Gradio interface
|
16 |
+
interface = gr.Interface(
|
17 |
+
fn=transcribe_audio,
|
18 |
+
inputs=gr.inputs.Audio(source="microphone", type="numpy", label="Speak or Upload an Audio File"),
|
19 |
+
outputs="text",
|
20 |
+
title="Conformer Large ASR",
|
21 |
+
description="Transcribe audio using NVIDIA NeMo's Conformer Large model."
|
22 |
+
)
|
23 |
+
|
24 |
+
# Launch the interface
|
25 |
+
interface.launch()
|