Pengwei Li
commited on
Commit
•
9fd9429
1
Parent(s):
fd08a89
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,14 @@
|
|
1 |
-
import os
|
2 |
-
os.system("pip install gradio==3.3")
|
3 |
import gradio as gr
|
4 |
-
import
|
5 |
-
import streamlit as st
|
6 |
-
|
7 |
-
title = "Fairseq S2S"
|
8 |
-
|
9 |
-
description = "Gradio Demo for fairseq S2S: speech-to-speech translation models. To use it, simply add your audio, or click one of the examples to load them. Read more at the links below."
|
10 |
-
|
11 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2107.05604' target='_blank'>Direct speech-to-speech translation with discrete units</a> | <a href='https://github.com/facebookresearch/fairseq/tree/main/examples/speech_to_speech' target='_blank'>Github Repo</a></p>"
|
12 |
-
|
13 |
-
examples = [
|
14 |
-
["enhanced_direct_s2st_units_audios_es-en_set2_source_12478_cv.flac","xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022"],
|
15 |
-
]
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
def inference(text,model):
|
20 |
-
outtext = io1(text)
|
21 |
-
return outtext
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
inference,
|
26 |
-
[gr.inputs.Audio(label="Input",type="filepath"),gr.inputs.Dropdown(choices=["xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022"], type="value", label="model")
|
27 |
-
],
|
28 |
-
gr.outputs.Audio(label="Output"),
|
29 |
-
article=article,
|
30 |
-
title=title,
|
31 |
-
description=description).queue().launch()
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
demo = gr.Interface.load(
|
7 |
+
"huggingface/facebook/xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022",
|
8 |
+
title="Speech-to-Speech",
|
9 |
+
inputs="mic",
|
10 |
+
description="Let me translate what you're saying!",
|
11 |
+
api_key=st.secrets["api_key"]
|
12 |
+
)
|
13 |
|
14 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|