Spaces:
Sleeping
Sleeping
import git | |
git.Repo.clone_from('https://github.com/reazon-research/ReazonSpeech', 'ReazonSpeech') | |
import pip, site, importlib | |
pip.main(['install', 'ReazonSpeech/pkg/nemo-asr']) | |
importlib.reload(site) | |
import gradio as gr | |
from reazonspeech.nemo.asr import audio_from_path, load_model, transcribe | |
model = None | |
def speech_to_text(audio_file): | |
global model | |
if not model: | |
model = load_model() | |
audio = audio_from_path(audio_file) | |
ret = transcribe(model, audio) | |
return ret.text | |
# ret.segments | |
# ret.subwords | |
gr.Interface( | |
fn=speech_to_text, | |
inputs=[ | |
gr.Audio(source="upload", type="filepath"), | |
], | |
outputs="text").launch() |