mrgmd01 commited on
Commit
493a4dc
Β·
verified Β·
1 Parent(s): bb3ec15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -76,22 +76,21 @@ def predict_and_save(text):
76
 
77
  # Gradio UI
78
  with gr.Blocks() as demo:
79
- gr.Markdown("# 🌍 Multilingual Sentiment Analysis")
80
- gr.Markdown("**Supports English, Urdu & Roman Urdu.**")
81
-
82
- with gr.Row():
83
- with gr.Column():
84
- textbox = gr.Textbox(lines=3, placeholder="Enter a sentence...")
85
- analyze_btn = gr.Button("πŸ” Analyze Sentiment")
86
- output = gr.Textbox(label="Prediction")
87
- download_btn = gr.File(label="Download Entered Sentences", type="filepath")
88
-
89
- # Link functions
90
- analyze_btn.click(
91
- fn=predict_and_save,
92
- inputs=textbox,
93
- outputs=[output, download_btn]
94
- )
95
-
96
  if __name__ == "__main__":
97
  demo.launch()
 
76
 
77
  # Gradio UI
78
  with gr.Blocks() as demo:
79
+ "## 🌍 Multilingual Sentiment Analysis (Positive β€’ Neutral β€’ Negative)\n"
80
+ "**Languages:** English, Urdu, Roman Urdu \n"
81
+ "Model: `siebert/sentiment-roberta-large-english (For English)`\n `mrgmd01/sentiment_model_FineTune_cardiffnlp(For Urdu & Roman Urdu)`"
82
+
83
+ with gr.Tab("πŸ”Ή Single Text"):
84
+ user_text = gr.Textbox(label="Enter text", placeholder="Type in English, Urdu, or Roman Urdu...")
85
+ lang_dropdown = gr.Dropdown(["English", "Urdu", "Roman Urdu"], label="Language Hint", value="English")
86
+ btn = gr.Button("Analyze")
87
+
88
+ out_sent = gr.Textbox(label="Sentiment")
89
+ out_conf = gr.Textbox(label="Confidence (0–1)")
90
+ out_pol = gr.Textbox(label="Polarity")
91
+ out_file = gr.File(label="Download logs (.xlsx)")
92
+
93
+ btn.click(analyze_single, inputs=[user_text, lang_dropdown],
94
+ outputs=[out_sent, out_conf, out_pol, out_file])
 
95
  if __name__ == "__main__":
96
  demo.launch()