import gradio as gr from gradio.mix import Parallel, Series from transformers import pipeline summarizer = pipeline("translation", model="VietAI/envit5-mtet_phomt-translation", use_auth_token=True) def translate(inp): text = "en: " + inp res = summarizer( text, max_length=512, early_stopping=True, )[0]['translation_text'] 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()