import gradio as gr from gradio.mix import Parallel, Series from transformers import pipeline translater = pipeline("translation", model="VietAI/envit5-translation") def translate(inp): text = "en: " + inp res = translater( text, max_length=512, early_stopping=True, )[0]['translation_text'][3:] return res sample_url = [['VietAI is a non-profit organization with the mission of nurturing AI talents and building a community of world-class AI experts in Vietnam.'],] article = "
by VietAI Research | Github | Contact: Hieu Tran
" iface = gr.Interface(fn=translate, inputs = gr.inputs.Textbox( lines = 5, label = 'Enter an article...' ), outputs = 'text', title = 'En<->Vi MTet Translation', theme = 'grass', layout = 'horizontal', article=article, examples=sample_url) iface.launch()