tahamueed23 commited on
Commit
92ffc2e
Β·
verified Β·
1 Parent(s): f705b01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -15
app.py CHANGED
@@ -465,9 +465,13 @@ with gr.Blocks(title="Multilingual Sentiment Analysis") as demo:
465
  - Roman Urdu: tahamueed23/roman-urdu-sentiment
466
  - Language detection: papluca/xlm-roberta-base-language-detection
467
  """)
468
-
 
 
 
469
  with gr.Row():
470
- with gr.Column():
 
471
  user_text = gr.Textbox(
472
  label="✍️ Enter Text",
473
  placeholder="Type in English, Urdu, or Roman Urdu...",
@@ -478,27 +482,39 @@ with gr.Blocks(title="Multilingual Sentiment Analysis") as demo:
478
  value="Auto Detect",
479
  label="🌐 Language Selection"
480
  )
481
-
482
  with gr.Row():
483
  btn_analyze = gr.Button("πŸ” Analyze Sentiment", variant="primary")
484
  btn_show = gr.Button("πŸ“‚ Show Logs")
485
  btn_clear = gr.Button("πŸ—‘οΈ Clear Logs")
486
-
487
- with gr.Column():
 
488
  out_sent = gr.Textbox(label="🎭 Sentiment")
489
  out_conf = gr.Textbox(label="πŸ“Š Confidence Score")
490
- out_exp = gr.Textbox(label="πŸ’‘ Detailed Explanation")
491
  out_strong = gr.Textbox(label="πŸ’ͺ Strong Words")
492
  out_file = gr.File(label="⬇️ Download Logs")
493
-
494
- logs_df = gr.Dataframe(
495
- headers=["Sentence", "Language", "Sentiment", "Confidence", "Strong_Words", "Timestamp"],
496
- label="πŸ“‹ Analysis History",
497
- interactive=False,
498
- wrap=True
499
- )
500
-
501
- # Event handlers - FIXED: Added missing closing parenthesis
 
 
 
 
 
 
 
 
 
 
 
502
  btn_analyze.click(
503
  analyze_sentiment_complete,
504
  inputs=[user_text, lang_dropdown],
 
465
  - Roman Urdu: tahamueed23/roman-urdu-sentiment
466
  - Language detection: papluca/xlm-roberta-base-language-detection
467
  """)
468
+
469
+ # -----------------------------
470
+ # TOP ROW (Two Blocks)
471
+ # -----------------------------
472
  with gr.Row():
473
+ # Left block (Text input + buttons)
474
+ with gr.Column(scale=1):
475
  user_text = gr.Textbox(
476
  label="✍️ Enter Text",
477
  placeholder="Type in English, Urdu, or Roman Urdu...",
 
482
  value="Auto Detect",
483
  label="🌐 Language Selection"
484
  )
485
+
486
  with gr.Row():
487
  btn_analyze = gr.Button("πŸ” Analyze Sentiment", variant="primary")
488
  btn_show = gr.Button("πŸ“‚ Show Logs")
489
  btn_clear = gr.Button("πŸ—‘οΈ Clear Logs")
490
+
491
+ # Right block (output results)
492
+ with gr.Column(scale=1):
493
  out_sent = gr.Textbox(label="🎭 Sentiment")
494
  out_conf = gr.Textbox(label="πŸ“Š Confidence Score")
495
+ out_exp = gr.Textbox(label="πŸ’‘ Detailed Explanation", lines=4)
496
  out_strong = gr.Textbox(label="πŸ’ͺ Strong Words")
497
  out_file = gr.File(label="⬇️ Download Logs")
498
+
499
+ # -----------------------------
500
+ # BOTTOM ROW (Two Blocks)
501
+ # -----------------------------
502
+ with gr.Row():
503
+ # Left block (analysis history)
504
+ with gr.Column(scale=1):
505
+ logs_df = gr.Dataframe(
506
+ headers=["Sentence", "Language", "Sentiment", "Confidence", "Strong_Words", "Timestamp"],
507
+ label="πŸ“‹ Analysis History",
508
+ interactive=False,
509
+ wrap=True,
510
+ height=350
511
+ )
512
+
513
+ # Right block can be empty or used later
514
+ with gr.Column(scale=1):
515
+ gr.Markdown("")
516
+
517
+ # Event handlers
518
  btn_analyze.click(
519
  analyze_sentiment_complete,
520
  inputs=[user_text, lang_dropdown],