Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import streamlit as st
|
|
6 |
|
7 |
title = "Fairseq Speech to Speech Translation"
|
8 |
|
9 |
-
description = "Gradio Demo for fairseq S2S: speech-to-speech translation models. To use it, simply record your audio
|
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 |
|
@@ -14,25 +14,28 @@ 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 |
-
io1 = gr.Interface.load("huggingface/facebook/
|
|
|
|
|
|
|
18 |
|
19 |
def inference(audio, model):
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
return out_audio
|
28 |
|
29 |
|
30 |
gr.Interface(
|
31 |
inference,
|
32 |
-
[gr.inputs.Audio(source="microphone", type="filepath", label="Input"),gr.inputs.Dropdown(choices=["
|
33 |
],
|
34 |
gr.outputs.Audio(label="Output"),
|
35 |
article=article,
|
36 |
title=title,
|
37 |
-
examples=examples,
|
38 |
description=description).queue().launch()
|
|
|
6 |
|
7 |
title = "Fairseq Speech to Speech Translation"
|
8 |
|
9 |
+
description = "Gradio Demo for fairseq S2S: speech-to-speech translation models. To use it, simply record your audio. 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 |
|
|
|
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 |
+
io1 = gr.Interface.load("huggingface/facebook/xm_transformer_s2ut_en-hk", api_key=st.secrets["api_key"])
|
18 |
+
io2 = gr.Interface.load("huggingface/facebook/xm_transformer_s2ut_hk-en", api_key=st.secrets["api_key"])
|
19 |
+
io3 = gr.Interface.load("huggingface/facebook/xm_transformer_unity_en-hk", api_key=st.secrets["api_key"])
|
20 |
+
io4 = gr.Interface.load("huggingface/facebook/xm_transformer_unity_hk-en", api_key=st.secrets["api_key"])
|
21 |
|
22 |
def inference(audio, model):
|
23 |
+
if model == "xm_transformer_s2ut_en-hk":
|
24 |
+
out_audio = io1(text)
|
25 |
+
elif model == "xm_transformer_s2ut_hk-en":
|
26 |
+
out_audio = io2(text)
|
27 |
+
elif model == "xm_transformer_unity_en-hk":
|
28 |
+
out_audio = io3(text)
|
29 |
+
else model == "xm_transformer_unity_en-hk":
|
30 |
+
out_audio = io4(text)
|
31 |
return out_audio
|
32 |
|
33 |
|
34 |
gr.Interface(
|
35 |
inference,
|
36 |
+
[gr.inputs.Audio(source="microphone", type="filepath", label="Input"),gr.inputs.Dropdown(choices=["xm_transformer_s2ut_en-hk", "xm_transformer_s2ut_hk-en", "xm_transformer_unity_en-hk", "xm_transformer_unity_en-hk"], default="xm_transformer_s2ut_en-hk",type="value", label="Model")
|
37 |
],
|
38 |
gr.outputs.Audio(label="Output"),
|
39 |
article=article,
|
40 |
title=title,
|
|
|
41 |
description=description).queue().launch()
|