datnth1709 commited on
Commit
e00f0bb
·
1 Parent(s): 3008991

update speech2text module

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -1,7 +1,5 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
-
4
- import gradio as gr
5
  from transformers.file_utils import cached_path, hf_bucket_url
6
  import os, zipfile
7
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
@@ -107,16 +105,17 @@ with gr.Blocks() as demo:
107
  translate_to_english.click(lambda text: translate_vi2en(text), inputs=vietnamese, outputs=english)
108
  gr.Examples(examples=vi_example_text,
109
  inputs=[vietnamese])
110
- with gr.TabItem("Speech2text translation: Vietnamese voice to English"):
111
- with gr.Row():
112
- inputs = gr.inputs.Audio(label="Input Audio", type="file")
113
- outputs = gr.outputs.Textbox(label="Output Text")
114
- title = "Speech to text and translate Vietnamese to English"
115
- description = "Gradio demo for a wav2vec2-base-vietnamese-250h and Helsinki-NLP/opus-mt-vi-en"
116
- iface = gr.Interface(inference,
117
- inputs,
118
- outputs,
119
- title=title,
120
- description=description,
121
- examples=vi_example_voice)
122
- iface.launch()
 
 
1
  import gradio as gr
2
  from transformers import pipeline
 
 
3
  from transformers.file_utils import cached_path, hf_bucket_url
4
  import os, zipfile
5
  from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
 
105
  translate_to_english.click(lambda text: translate_vi2en(text), inputs=vietnamese, outputs=english)
106
  gr.Examples(examples=vi_example_text,
107
  inputs=[vietnamese])
108
+ with gr.TabItem("Speech2text and translation"):
109
+ inputs = gr.inputs.Audio(label="Input Audio", type="file")
110
+ outputs = gr.outputs.Textbox(label="Output Text")
111
+ title = "Speech to text and translate Vietnamese to English"
112
+ description = "Gradio demo for a wav2vec2-base-vietnamese-250h and Helsinki-NLP/opus-mt-vi-en"
113
+ gr.Interface(inference,
114
+ inputs,
115
+ outputs,
116
+ title=title,
117
+ description=description,
118
+ examples=vi_example_voice)
119
+
120
+ if __name__ == "__main__":
121
+ demo.launch()