|
import nemo.collections.asr as nemo_asr |
|
import gradio as gr |
|
|
|
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large") |
|
|
|
def transcribe(file): |
|
|
|
|
|
|
|
|
|
print("filename: ",file) |
|
transcription= asr_model.transcribe([file]) |
|
print(transcription) |
|
return transcription[0] |
|
|
|
|
|
with gr.Blocks() as demo: |
|
|
|
|
|
with gr.Row(): |
|
with gr.Column(): |
|
uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath") |
|
|
|
with gr.Column(): |
|
transcription = gr.Textbox(type="text", label="Transcription") |
|
with gr.Row(): |
|
transcribe_button = gr.Button("Transcribe") |
|
|
|
transcribe_button.click( |
|
transcribe, |
|
[uploaded_audio], |
|
transcription |
|
) |
|
|
|
|
|
demo.launch() |