Kleber commited on
Commit
c4af624
·
verified ·
1 Parent(s): 1bea04b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -3,28 +3,30 @@ import gradio as gr
3
 
4
  def transcribe(state, file):
5
 
6
- if not audio:
7
  return {state_var: state, transcription_var: state}
8
- asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(
9
  model_name="stt_rw_conformer_ctc_large")
10
 
11
- transcription= asr_model.transcribe([audio])
12
- return transcription[0]
13
 
14
 
15
  with gr.Blocks() as demo:
16
- state_var = gr.State("")
17
 
18
- with gr.Row():
19
- with gr.Column():
20
- uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath")
21
 
 
 
22
  with gr.Row():
23
  transcribe_button = gr.Button("Transcribe")
24
 
25
  transcribe_button.click(
26
- transcribe,
27
- [uploaded_audio],
28
  )
29
 
30
 
 
3
 
4
  def transcribe(state, file):
5
 
6
+ if not audio:
7
  return {state_var: state, transcription_var: state}
8
+ asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(
9
  model_name="stt_rw_conformer_ctc_large")
10
 
11
+ transcription= asr_model.transcribe([audio])
12
+ return transcription[0]
13
 
14
 
15
  with gr.Blocks() as demo:
16
+ state_var = gr.State("")
17
 
18
+ with gr.Row():
19
+ with gr.Column():
20
+ uploaded_audio = gr.Audio(label="Upload Audio File", type="filepath")
21
 
22
+ with gr.Column():
23
+ transcription_var = gr.Textbox(type="text", label="Transcription", readonly=True)
24
  with gr.Row():
25
  transcribe_button = gr.Button("Transcribe")
26
 
27
  transcribe_button.click(
28
+ transcribe,
29
+ [uploaded_audio],
30
  )
31
 
32