vsrinivas's picture
Update app.py
2423800
raw
history blame
No virus
1.13 kB
import gradio as gr
from transformers import pipeline
translator = pipeline("translation", model="vsrinivas/marian-finetuned-kde4-en-to-hi")
def translate(input):
output = translator(input)
return output[0]['translation_text']
demo = gr.Interface(fn=translate,
inputs=[gr.Textbox(label="English text that you want to translate into Hindi !", lines=6)],
outputs=[gr.Textbox(label="Translated Hindi Text !!!", lines=3)],
title="English to Hindi Text translation test and demo app by Srinivas.V ..",
description="Translates English text into Hindi text",
allow_flagging="never",
examples = ["India is my country and all Indians are my brothers and sisters. I love my country and I am proud of its rich and varied heritage. I shall always strive to be worthy of it. I shall give my parents, teachers and all elders respect and treat everyone with courtesy. To my country and my people, I pledge my devotion. In their well-being and prosperity alone lies my happiness."]
)
demo.launch()