spookyspaghetti commited on
Commit
12b8cb1
1 Parent(s): 43be5c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,5 +1,15 @@
1
  import gradio as gr
2
 
3
  #gr.Interface.load("models/nvidia/stt_en_citrinet_1024_gamma_0_25").launch()
4
-
5
- gr.Interface.load("models/vennify/t5-base-grammar-correction").launch()
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
  #gr.Interface.load("models/nvidia/stt_en_citrinet_1024_gamma_0_25").launch()
4
+ from nemo.collections.asr.models import ASRModel
5
+ import torch
6
+ if torch.cuda.is_available():
7
+ device = torch.device(f'cuda:0')
8
+ asr_model = ASRModel.from_pretrained(model_name='stt_en_citrinet_1024')
9
+ def transcribe(audio):
10
+ """Speech to text using Nvidia Nemo"""
11
+ text = asr_model.transcribe(paths2audio_files=[audio])[0]
12
+ correct = list(gf.correct(text, max_candidates = 1))[0]
13
+ return text, correct
14
+
15
+ gr.Interface(fn=transcribe).launch()