Shangkhonil commited on
Commit
9477d2a
·
verified ·
1 Parent(s): ca2b65c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("translation", model="csebuetnlp/banglat5_nmt_bn_en")
5
+
6
+ def translate(text):
7
+ return pipe(text)[0]['translation_text']
8
+
9
+ app = gr.Interface(
10
+ fn=translate, # Function for translation
11
+ inputs=gr.Textbox(lines=2, placeholder="Enter text to translate"), # Updated input field
12
+ outputs=gr.Textbox(), # Updated output field
13
+ title="Text Translator", # Title of the app
14
+ description="Enter text to translate from English to German using Google T5 small model."
15
+ )
16
+ if __name__ == "__main__":
17
+ app.launch()