SLPG / app.py
samiulhaq's picture
Create new file
28844b4
raw
history blame
581 Bytes
from transformers import pipeline
generate=pipeline("translation_en_to_fr",model="t5-large")
import gradio as gr
title=""" <hi> Here to convert your English text to French</h1>"""
description="""<h5> This demo app is for english french language translation</h5>"""
def en_fr(english_text):
fr=generate(english_text)
translation=fr[0]["translation_text"]
return translation
demo =gr.Interface(fn=en_fr,inputs=gr.Textbox(label="English version"),outputs=gr.Textbox(label="French version"),title=title,description=description)
if __name__ =="__main__":
demo.launch()