import os os.system("pip install gradio==3.3") import gradio as gr import numpy as np title = "SpeechMatrix Speech-to-speech Translation" description = "Gradio Demo for SpeechMatrix. To use it, simply record your audio, or click the example to load. Read more at the links below." article = "
" examples = [] io1 = gr.Interface.load("huggingface/facebook/xm_transformer_sm_all-en") def inference(audio, model): out_audio = io1(audio) return out_audio model_choices = ["xm_transformer_sm_all-en"] for src in ['cs', 'de', 'en', 'es', 'et', 'fi', 'fr', 'hr', 'hu', 'it', 'nl', 'pl', 'pt', 'ro', 'sk', 'sl']: for tgt in ['en', 'fr', 'de']: if src != tgt: model_choices.append(f"textless_sm_{src}_{tgt}") gr.Interface( inference, [gr.inputs.Audio(source="microphone", type="filepath", label="Input"),gr.inputs.Dropdown(choices=["xm_transformer_sm_all-en"], default="xm_transformer_sm_all-en",type="value", label="Model") ], gr.outputs.Audio(label="Output"), article=article, title=title, examples=examples, cache_examples=False, description=description).queue().launch()