UrduNMT / app.py
samiulhaq's picture
Create app.py
b9d5f4f
raw
history blame contribute delete
664 Bytes
from transformers import pipeline
generate=pipeline("translation_en_to_fr",model="t5-large")
import gradio as gr
title=""" <hi> Translate English text to French</h1>"""
description="""<h5> This 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"),
outputs=gr.Textbox(label="French"),
title=title,
description=description,
examples=[["Hello! My name is Abubakar"], ["How are you?"]])
if __name__ =="__main__":
demo.launch()