Shangkhonil's picture
Create app.py
9477d2a verified
raw
history blame
628 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("translation", model="csebuetnlp/banglat5_nmt_bn_en")
def translate(text):
return pipe(text)[0]['translation_text']
app = gr.Interface(
fn=translate, # Function for translation
inputs=gr.Textbox(lines=2, placeholder="Enter text to translate"), # Updated input field
outputs=gr.Textbox(), # Updated output field
title="Text Translator", # Title of the app
description="Enter text to translate from English to German using Google T5 small model."
)
if __name__ == "__main__":
app.launch()