Speech-Analyser / app.py
spookyspaghetti's picture
Update app.py
12b8cb1
raw
history blame
545 Bytes
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()