Create app.y
Browse files
app.y
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import nemo.collections.asr as nemo_asr
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def transcribe(state, file):
|
5 |
+
|
6 |
+
if not audio:
|
7 |
+
return {state_var: state, transcription_var: state}
|
8 |
+
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(
|
9 |
+
model_name="stt_rw_conformer_ctc_large")
|
10 |
+
|
11 |
+
transcription= asr_model.transcribe([audio])
|
12 |
+
return transcription[0]
|
13 |
+
|
14 |
+
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
state_var = gr.State("")
|
17 |
+
|
18 |
+
with gr.Row():
|
19 |
+
with gr.Column():
|
20 |
+
uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath", source="upload")
|
21 |
+
|
22 |
+
with gr.Row():
|
23 |
+
transcribe_button = gr.Button("Transcribe")
|
24 |
+
|
25 |
+
transcribe_button.click(
|
26 |
+
transcribe,
|
27 |
+
[uploaded_audio],
|
28 |
+
)
|
29 |
+
|
30 |
+
|
31 |
+
demo.launch()
|