File size: 856 Bytes
580817b
 
 
 
 
d4216a0
 
 
580817b
c4af624
556da87
c4af624
580817b
 
 
c4af624
580817b
c4af624
 
 
580817b
c4af624
90763d6
580817b
 
 
 
c4af624
 
580817b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import nemo.collections.asr as nemo_asr
import gradio as gr

def transcribe(state, file):

    if not audio:
        return {state_var: state, transcription_var: state} 
    asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large")
                
    transcription= asr_model.transcribe([audio])
    print(transcription)
    return  transcription[0]


with gr.Blocks() as demo:
    state_var = gr.State("")

    with gr.Row():
        with gr.Column():
            uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath")

        with gr.Column():
            transcription_var = gr.Textbox(type="text", label="Transcription")
    with gr.Row():
      transcribe_button = gr.Button("Transcribe")

    transcribe_button.click(
        transcribe,
        [uploaded_audio],
    )

  
demo.launch()