Shangkhonil commited on
Commit
2ce07b3
1 Parent(s): 9477d2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -4,14 +4,15 @@ from transformers import pipeline
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()
 
4
  pipe = pipeline("translation", model="csebuetnlp/banglat5_nmt_bn_en")
5
 
6
  def translate(text):
7
+ translation = pipe(text)[0]['translation_text']
8
+ return translation
9
 
10
+ interface = gr.Interface(
11
+ fn=translate,
12
+ inputs=gr.inputs.Textbox(label="Input Text in Bangla"),
13
+ outputs=gr.outputs.Textbox(label="Translated Text in English"),
14
+ title="Bangla to English Translator",
15
+ description="Translate Bangla text into English using a Hugging Face model."
16
  )
17
  if __name__ == "__main__":
18
+ interface.launch()