theodotus commited on
Commit
056b612
1 Parent(s): 4c3bd4e

Added working microfone example

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +19 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .env
2
+ flagged
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ import nemo.collections.asr as nemo_asr
4
+
5
+
6
+ asr_model = nemo_asr.models.EncDecCTCModelBPE. \
7
+ from_pretrained("theodotus/stt_uk_squeezeformer_ctc_xs",map_location="cpu")
8
+
9
+
10
+
11
+ def transcribe(audio):
12
+ text = asr_model.transcribe([audio], batch_size=1)[0]
13
+ return text
14
+
15
+
16
+ gr.Interface(
17
+ fn=transcribe,
18
+ inputs=gr.Audio(source="microphone", type="filepath"),
19
+ outputs="text").launch()