Spaces:
Runtime error
Runtime error
Commit
·
e00f0bb
1
Parent(s):
3008991
update speech2text module
Browse files
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
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
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()
|