speech_matrix / app.py
gmdnn's picture
Update app.py
3f873d4
raw
history blame contribute delete
734 Bytes
import os
import gradio as gr
SRC_LIST = ['cs', 'de', 'en', 'es', 'et', 'fi', 'fr', 'hr', 'hu', 'it', 'nl', 'pl', 'pt', 'ro', 'sk', 'sl']
TGT_LIST = ['en', 'fr', 'es']
MODEL_LIST = ['xm_transformer_sm_all-en']
for src in SRC_LIST:
for tgt in TGT_LIST:
if src != tgt:
MODEL_LIST.append(f"textless_sm_{src}_{tgt}")
examples = []
io_dict = {model: gr.load(f"huggingface/facebook/{model}") for model in MODEL_LIST}
def inference(audio, model):
out_audio = io_dict[model](audio)
return out_audio
gr.Interface(
inference,
[gr.Audio(source="microphone", type="filepath", label="Input"),gr.Dropdown(choices=MODEL_LIST, type="value", label="Model")
],
gr.Audio(label="Output")).queue().launch()