MatteoFasulo commited on
Commit
da38f38
Β·
verified Β·
1 Parent(s): b2bb55d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -12,9 +12,8 @@ sentiment_model = "MatteoFasulo/mdeberta-v3-base-subjectivity-sentiment-multilin
12
 
13
  # Define some examples for the Gradio interface (cached to run on-the-fly)
14
  examples = [
15
- ['Example1'],
16
- ['Example2'],
17
- ['Example3'],
18
  ]
19
 
20
  # Custom model class for combining sentiment analysis with subjectivity detection
@@ -133,17 +132,14 @@ def analyze(text):
133
  return table_data
134
 
135
  # Update the Gradio interface
136
- with gr.Blocks(theme=gr.themes.Soft(), css="""
137
- #result_table td { padding: 8px; font-size: 1rem; }
138
- #header { text-align: center; font-size: 2rem; font-weight: bold; margin-bottom: 10px; }
139
- """) as demo:
140
- gr.Markdown("<div id='header'>πŸš€ Advanced Subjectivity & Sentiment Dashboard πŸš€</div>")
141
  with gr.Row():
142
  txt = gr.Textbox(label="Enter text to analyze", placeholder="Paste news sentence here...", lines=2)
143
  btn = gr.Button("Analyze πŸ”", variant="primary")
144
  with gr.Tabs():
145
  with gr.TabItem("Raw Scores πŸ“‹"):
146
- table = gr.Dataframe(headers=["Metric", "Value"], datatype=["str","str"], interactive=False, elem_id="result_table")
147
  with gr.TabItem("About ℹ️"):
148
  gr.Markdown("This dashboard uses two DeBERTa-based models (with and without sentiment integration) to detect subjectivity, alongside sentiment scores from an XLM-RoBERTa model.")
149
  with gr.Row():
@@ -154,10 +150,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css="""
154
  outputs=[table],
155
  fn=analyze,
156
  label="Examples",
157
- elem_id="example_list",
158
  cache_examples=True,
159
  )
160
  # Link inputs to outputs
161
  btn.click(fn=analyze, inputs=txt, outputs=[table])
162
 
163
- demo.queue().launch(server_name="0.0.0.0", share=True)
 
12
 
13
  # Define some examples for the Gradio interface (cached to run on-the-fly)
14
  examples = [
15
+ ["But then Trump came to power and sidelined the defense hawks, ushering in a dramatic shift in Republican sentiment toward America's allies and adversaries."],
16
+ ["Boxing Day ambush & flagship attack Putin has long tried to downplay the true losses his army has faced in the Black Sea."],
 
17
  ]
18
 
19
  # Custom model class for combining sentiment analysis with subjectivity detection
 
132
  return table_data
133
 
134
  # Update the Gradio interface
135
+ with gr.Blocks(theme=gr.themes.Base()) as demo:
136
+ gr.Markdown("πŸš€ Advanced Subjectivity & Sentiment Dashboard πŸš€")
 
 
 
137
  with gr.Row():
138
  txt = gr.Textbox(label="Enter text to analyze", placeholder="Paste news sentence here...", lines=2)
139
  btn = gr.Button("Analyze πŸ”", variant="primary")
140
  with gr.Tabs():
141
  with gr.TabItem("Raw Scores πŸ“‹"):
142
+ table = gr.Dataframe(headers=["Metric", "Value"], datatype=["str","str"], interactive=False)
143
  with gr.TabItem("About ℹ️"):
144
  gr.Markdown("This dashboard uses two DeBERTa-based models (with and without sentiment integration) to detect subjectivity, alongside sentiment scores from an XLM-RoBERTa model.")
145
  with gr.Row():
 
150
  outputs=[table],
151
  fn=analyze,
152
  label="Examples",
 
153
  cache_examples=True,
154
  )
155
  # Link inputs to outputs
156
  btn.click(fn=analyze, inputs=txt, outputs=[table])
157
 
158
+ demo.queue().launch()