Spaces:
Runtime error
Runtime error
File size: 1,149 Bytes
4d5c4f0 800a78c 4d5c4f0 d2e2101 9b14ce7 d2e2101 d0189c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
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 = "<p style='text-align: center'><a href='https://arxiv.org/abs/2001.08210' target='_blank'>Multilingual Denoising Pre-training for Neural Machine Translation</a></p>"
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) |