Update app.py
Browse files
app.py
CHANGED
|
@@ -41,24 +41,34 @@ def predict_bangla_sentence(sentence):
|
|
| 41 |
return f"Predicted Class: {sentence_type}"
|
| 42 |
|
| 43 |
# Create Gradio UI
|
|
|
|
| 44 |
iface = gr.Interface(
|
| 45 |
fn=predict_bangla_sentence,
|
| 46 |
inputs=gr.Textbox(lines=2, placeholder="Enter a sentence in any language...", label="Sentence"),
|
| 47 |
-
outputs=gr.Textbox(lines=2, label="Output"),
|
| 48 |
-
title="Multilingual Sentence Classifier",
|
| 49 |
description = (
|
| 50 |
"This model was trained using a curated Bangla dataset by **TextLab RUET**. "
|
| 51 |
"It can classify sentences in various languages into five distinct categories: Assertive, Interrogative, Imperative, Optative, and Exclamatory. \n\n"
|
| 52 |
"Although it was fine-tuned on Bangla sentences, the model **XLM-R** (a multilingual transformer model based on the BERT architecture) uses transfer learning "
|
| 53 |
"to apply its knowledge from over 100 languages, enabling it to classify sentences in a wide variety of languages, including Bangla, English, Spanish, French, German, and more.\n\n"
|
| 54 |
-
|
| 55 |
"**Note**: While we strive for accuracy, the model may occasionally misclassify sentences due to dataset limitations. "
|
| 56 |
"We apologize for any errors and appreciate your understanding.\n\n"
|
| 57 |
-
|
| 58 |
"**Enter a sentence in any language below to see how our model interprets it!** 🤖"
|
| 59 |
),
|
| 60 |
-
theme="compact"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
# Launch the Gradio app
|
| 64 |
-
iface.launch(share=True)
|
|
|
|
| 41 |
return f"Predicted Class: {sentence_type}"
|
| 42 |
|
| 43 |
# Create Gradio UI
|
| 44 |
+
|
| 45 |
iface = gr.Interface(
|
| 46 |
fn=predict_bangla_sentence,
|
| 47 |
inputs=gr.Textbox(lines=2, placeholder="Enter a sentence in any language...", label="Sentence"),
|
| 48 |
+
outputs=gr.Textbox(lines=2, label="Output"),
|
| 49 |
+
title="Multilingual Sentence Classifier 🌍",
|
| 50 |
description = (
|
| 51 |
"This model was trained using a curated Bangla dataset by **TextLab RUET**. "
|
| 52 |
"It can classify sentences in various languages into five distinct categories: Assertive, Interrogative, Imperative, Optative, and Exclamatory. \n\n"
|
| 53 |
"Although it was fine-tuned on Bangla sentences, the model **XLM-R** (a multilingual transformer model based on the BERT architecture) uses transfer learning "
|
| 54 |
"to apply its knowledge from over 100 languages, enabling it to classify sentences in a wide variety of languages, including Bangla, English, Spanish, French, German, and more.\n\n"
|
|
|
|
| 55 |
"**Note**: While we strive for accuracy, the model may occasionally misclassify sentences due to dataset limitations. "
|
| 56 |
"We apologize for any errors and appreciate your understanding.\n\n"
|
|
|
|
| 57 |
"**Enter a sentence in any language below to see how our model interprets it!** 🤖"
|
| 58 |
),
|
| 59 |
+
theme="compact",
|
| 60 |
+
css="""
|
| 61 |
+
.gradio-container {
|
| 62 |
+
display: flex;
|
| 63 |
+
justify-content: center;
|
| 64 |
+
align-items: center;
|
| 65 |
+
height: 100vh;
|
| 66 |
+
}
|
| 67 |
+
.gradio-title {
|
| 68 |
+
text-align: center;
|
| 69 |
+
}
|
| 70 |
+
"""
|
| 71 |
)
|
| 72 |
|
| 73 |
# Launch the Gradio app
|
| 74 |
+
iface.launch(share=True)
|