Pengwei Li
Update app.py
4f2f92f
raw
history blame
No virus
1.38 kB
import os
os.system("pip install gradio==2.8.0b2")
import gradio as gr
import numpy as np
title = "Fairseq S2S"
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."
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>"
examples = [
["enhanced_direct_s2st_units_audios_es-en_set2_source_12478_cv.flac","xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022"],
]
io1 = gr.Interface.load("huggingface/facebook/xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022")
def inference(text,model):
outtext = gr.Interface.load("huggingface/facebook/xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022")
return outtext
gr.Interface(
inference,
[gr.inputs.Audio(label="Input",type="filepath"),gr.inputs.Dropdown(choices=["xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022"], type="value", default="xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022", label="model")
],
gr.outputs.Audio(label="Output"),
article=article,
title=title,
examples=examples,
description=description).launch()