File size: 545 Bytes
0432ec8
 
61ea96e
12b8cb1
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr

#gr.Interface.load("models/nvidia/stt_en_citrinet_1024_gamma_0_25").launch()
from nemo.collections.asr.models import ASRModel
import torch
if torch.cuda.is_available():
    device = torch.device(f'cuda:0')
asr_model = ASRModel.from_pretrained(model_name='stt_en_citrinet_1024')
def transcribe(audio):
  """Speech to text using Nvidia Nemo"""
  text = asr_model.transcribe(paths2audio_files=[audio])[0]
  correct = list(gf.correct(text, max_candidates = 1))[0]
  return text, correct
    
gr.Interface(fn=transcribe).launch()