import gradio as gr from transformers import pipeline examples = [ "Where is she?", "I would like to test this new model for machine translation", "All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience..." ] generator = pipeline("text2text-generation", model="jo-valer/nllb-multi") def translate(text): return generator(text)[0]["generated_text"] interface = gr.Interface( fn=translate, inputs=gr.Textbox(lines=3, placeholder="Enter English/Italian Text Here...", label="Input text"), outputs=gr.Textbox(label="Ladin Translation", show_copy_button=True), title="Ladin Machine Translation", allow_flagging="never", examples=examples, cache_examples=True, ) interface.launch()