import gradio as gr title = "MBart" description = "Gradio Demo for MBart. To use it, simply add your text, or click one of the examples to load them. Read more at the links below." article = "

Multilingual Denoising Pre-training for Neural Machine Translation

" examples = [ ["Paris is the capital of France","mbart-large-50-one-to-many-mmt"] ] io1 = gr.Interface.load("huggingface/facebook/mbart-large-50-one-to-many-mmt") io2 = gr.Interface.load("huggingface/facebook/mbart-large-50") def inference(text, model): if model == "mbart-large-50-one-to-many-mmt": outtext = io1(text) else: outtext = io2(text) return outtext gr.Interface( inference, [gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["mbart-large-50-one-to-many-mmt","mbart-large-50"], type="value", default="mbart-large-50-one-to-many-mmt", label="model") ], gr.outputs.Textbox(label="Output"), examples=examples, article=article, title=title, description=description).launch(enable_queue=True)