Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
fn=translate,
|
| 11 |
-
inputs=gr.Textbox(
|
| 12 |
-
outputs=gr.Textbox(
|
| 13 |
-
title="
|
| 14 |
-
description="
|
| 15 |
)
|
| 16 |
if __name__ == "__main__":
|
| 17 |
-
|
|
|
|
| 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()
|