roncc13 commited on
Commit
042d556
·
verified ·
1 Parent(s): 6bd8fc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +220 -246
app.py CHANGED
@@ -2,6 +2,9 @@ import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
  import torch
4
 
 
 
 
5
  MODEL_ID = "roncc13/trainCMDBERT-sample"
6
 
7
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
@@ -26,90 +29,157 @@ def classify(text: str):
26
  return {label_names[i]: float(probs[i]) for i in range(len(label_names))}
27
 
28
 
 
 
 
29
  custom_css = """
30
  body {
31
- background: radial-gradient(circle at top left, #262845 0, #10111e 45%, #060712 100%);
 
32
  }
33
  .gradio-container {
34
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
35
  "Segoe UI", sans-serif;
36
  max-width: 1120px !important;
37
  margin: 0 auto !important;
38
- padding: 32px 16px 40px 16px !important;
39
- color: #f5f6ff;
40
  }
 
 
41
  .glass-card {
42
- background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.02));
43
- border-radius: 20px;
44
- border: 1px solid rgba(255,255,255,0.16);
45
- box-shadow: 0 18px 45px rgba(0,0,0,0.7);
46
  padding: 20px 22px;
47
- backdrop-filter: blur(20px);
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  .hero-title {
50
- font-size: 30px;
51
  font-weight: 700;
52
  letter-spacing: 0.02em;
53
  line-height: 1.2;
54
- margin-bottom: 6px;
 
55
  }
56
  .hero-subtitle {
57
- font-size: 13px;
58
- max-width: 560px;
59
- opacity: 0.85;
 
60
  }
 
 
61
  .btn-primary-custom {
62
- background: linear-gradient(135deg, #1fd39a, #19b984) !important;
63
- color: #041110 !important;
64
  border-radius: 999px !important;
65
  border: none !important;
66
  padding: 10px 26px !important;
67
  font-weight: 600 !important;
68
- box-shadow: 0 14px 30px rgba(11, 176, 123, 0.6);
69
  }
70
  .btn-secondary-custom {
71
- background: rgba(255,255,255,0.02) !important;
72
- color: rgba(245,246,255,0.90) !important;
73
  border-radius: 999px !important;
74
- border: 1px solid rgba(255,255,255,0.25) !important;
75
  padding: 10px 22px !important;
76
  font-size: 11px !important;
77
  }
 
 
78
  .conf-bar-bg {
79
- margin-top: 12px;
80
  width: 100%;
81
  height: 8px;
82
  border-radius: 999px;
83
- background: rgba(255,255,255,0.1);
84
  }
85
  .conf-bar-fill {
86
  height: 100%;
87
  border-radius: inherit;
88
- background: linear-gradient(90deg, #ff9c8b, #ff6e87);
89
  }
90
  .badge-pill {
91
  display: inline-flex;
92
  align-items: center;
93
  padding: 4px 14px;
94
  border-radius: 999px;
95
- font-size: 12px;
96
  font-weight: 600;
97
  }
98
  .badge-fake {
99
- background: #ff9c8b;
100
- color: #3b1b19;
101
  }
102
  .badge-real {
103
- background: #7fe6c2;
104
- color: #07352a;
105
  }
 
 
106
  textarea {
107
- background: #050515 !important;
108
- border-radius: 12px !important;
109
- border: 1px solid rgba(255,255,255,0.12) !important;
110
- color: #f5f6ff !important;
111
  font-size: 13px !important;
112
  }
 
 
113
  @media (max-width: 900px) {
114
  .two-col {
115
  flex-direction: column !important;
@@ -118,228 +188,132 @@ textarea {
118
  """
119
 
120
 
 
 
 
121
  with gr.Blocks(fill_height=True) as demo:
122
- # top padding so content is not glued to the tabs
123
- gr.HTML("<div style='height: 10px;'></div>")
124
-
125
- with gr.Tab("Analyzer"):
126
- with gr.Row():
127
- with gr.Column():
128
- gr.HTML(
129
- """
130
- <section style="margin-bottom:22px;">
131
- <div class="hero-title">
132
- Check Cebuano text for a misleading writing style.
133
- </div>
134
- <div class="hero-subtitle">
135
- Paste a headline, post, or short article. CMD‑BERT returns a label
136
- (Fake or Legit) and a confidence score based on writing patterns.
137
- It does not verify factual correctness.
138
- </div>
139
- </section>
140
- """
141
- )
142
 
143
- with gr.Row(elem_classes=["two-col"], equal_height=True):
144
- # Left: input card
145
- with gr.Column(scale=3):
146
- with gr.Group(elem_classes=["glass-card"]):
147
- gr.Markdown(
148
- "#### Text input\n"
149
- "Cebuano only. This tool checks linguistic patterns; it does not verify facts."
150
- )
151
- gr.Markdown(
152
- "> **Example** \n"
153
- "> “Nakadisubre og milagro nga tambal sa COVID‑19 ang usa ka local doktor, "
154
- "giingon nga walay side effects ug dili kinahanglan og bakuna.”"
155
- )
156
- news_text = gr.Textbox(
157
- lines=7,
158
- label="",
159
- placeholder="Paste Cebuano news text here..."
160
- )
161
- with gr.Row():
162
- analyze_btn = gr.Button("Analyze", elem_classes=["btn-primary-custom"])
163
- clear_btn = gr.Button("Clear", elem_classes=["btn-secondary-custom"])
164
- gr.Markdown(
165
- "<span style='font-size:11px;opacity:0.8;'>"
166
- "Tip: Keep inputs under 1,000 characters for faster results."
167
- "</span>"
168
- )
169
 
170
- # Right: result card
171
- with gr.Column(scale=2):
172
- with gr.Group(elem_classes=["glass-card"]):
173
- gr.Markdown("#### Result")
174
- result_label_html = gr.HTML(
175
- '<span class="badge-pill badge-fake">FAKE</span>'
176
- )
177
- conf_text = gr.HTML(
178
- '<div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">'
179
- '<span style="font-size:28px;font-weight:600;" id="conf-val">0.00</span>'
180
- '<span style="font-size:12px;opacity:0.8;">confidence</span>'
181
- '</div>'
182
- )
183
- conf_bar = gr.HTML(
184
- '<div class="conf-bar-bg">'
185
- '<div class="conf-bar-fill" style="width:0%;"></div>'
186
- '</div>'
187
- )
188
- gr.Markdown(
189
- "<span style='font-size:11px;opacity:0.85;'>"
190
- "Model: CMD‑BERT (fine‑tuned BERT‑base). "
191
- "Output: Label and confidence score for the submitted text."
192
- "</span>"
193
- )
 
 
 
194
 
195
- def analyze_ui(text):
196
- probs = classify(text)
197
- fake_p = probs.get("fake", 0.0)
198
- real_p = probs.get("real", 0.0)
199
- if fake_p >= real_p:
200
- label = "FAKE"
201
- css_class = "badge-pill badge-fake"
202
- conf = fake_p
203
- else:
204
- label = "LEGIT"
205
- css_class = "badge-pill badge-real"
206
- conf = real_p
207
- conf_pct = int(conf * 100)
208
- label_html = f'<span class="{css_class}">{label}</span>'
209
- conf_html = (
210
- '<div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">'
211
- f'<span style="font-size:28px;font-weight:600;" id="conf-val">{conf:.2f}</span>'
212
- '<span style="font-size:12px;opacity:0.8;">confidence</span>'
213
- '</div>'
214
- )
215
- bar_html = (
216
- '<div class="conf-bar-bg">'
217
- f'<div class="conf-bar-fill" style="width:{conf_pct}%;"></div>'
218
- '</div>'
219
- )
220
- return label_html, conf_html, bar_html
221
 
222
- analyze_btn.click(
223
- fn=analyze_ui,
224
- inputs=news_text,
225
- outputs=[result_label_html, conf_text, conf_bar],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  )
227
- clear_btn.click(fn=lambda: "", inputs=None, outputs=[news_text])
228
-
229
- # --- How it works tab ---
230
- with gr.Tab("How it works"):
231
- with gr.Group(elem_classes=["glass-card"]):
232
- gr.Markdown(
233
- "## How CMD‑BERT works\n"
234
- "CMD‑BERT is an AI‑augmented linguistic model that focuses on writing style, "
235
- "not literal truth. It looks for patterns such as exaggerated wording, "
236
- "over‑confident claims, and framing that often appear in misleading content."
237
- )
238
- with gr.Row():
239
- with gr.Column():
240
- with gr.Group(elem_classes=["glass-card"]):
241
- gr.Markdown(
242
- "### 1. Input and preprocessing\n"
243
- "- User pastes a Cebuano headline, post, or short article.\n"
244
- "- The text is tokenized and trimmed to a safe maximum length.\n"
245
- "- Inputs are processed in memory and not stored permanently."
246
- )
247
- with gr.Column():
248
- with gr.Group(elem_classes=["glass-card"]):
249
- gr.Markdown(
250
- "### 2. CMD‑BERT analysis\n"
251
- "- CMD‑BERT is a fine‑tuned BERT‑base model trained on Cebuano news.\n"
252
- "- It computes probabilities for two classes: **Fake** and **Legit**.\n"
253
- "- The highest‑probability class becomes the predicted label."
254
- )
255
- with gr.Group(elem_classes=["glass-card"]):
256
- gr.Markdown(
257
- "### 3. Result and interpretation\n"
258
- "- The interface shows the predicted label and confidence bar.\n"
259
- "- Users are reminded that this is a screening tool only.\n"
260
- "- Final judgment should always involve human critical thinking."
261
- )
262
-
263
- # --- About tab ---
264
- with gr.Tab("About"):
265
- with gr.Group(elem_classes=["glass-card"]):
266
- gr.Markdown(
267
- "## About CMD‑BERT\n"
268
- "**CMD‑BERT: An AI Augmented Linguistic Recognition Model for Cebuano Fake News Detection**\n\n"
269
- "CMD‑BERT is a thesis project in the Department of Computer Engineering at "
270
- "Cebu Technological University–Main Campus. The tool aims to support Cebuano readers "
271
- "by highlighting potentially misleading writing patterns in online news and posts."
272
- )
273
- with gr.Group(elem_classes=["glass-card"]):
274
- gr.Markdown(
275
- "### Thesis information\n"
276
- "_A Thesis Project presented to the Faculty of the Department of Computer Engineering_\n\n"
277
- "Cebu Technological University–Main Campus \n"
278
- "Cebu City, Philippines \n\n"
279
- "_In partial fulfillment of the requirements for the degree_ \n"
280
- "**Bachelor of Science in Computer Engineering**\n\n"
281
- "**By:** \n"
282
- "- Cabag, Ronilo Jose Jr. S. \n"
283
- "- Libron, Andio Mart \n"
284
- "- Omega, Noel \n\n"
285
- "**Adviser:** Engr. Jueco, M.Eng. \n"
286
- "January 2026"
287
- )
288
-
289
- # --- Feedback tab ---
290
- with gr.Tab("Feedback"):
291
- with gr.Group(elem_classes=["glass-card"]):
292
- gr.Markdown(
293
- "## Feedback and model improvement\n"
294
- "CMD‑BERT is experimental and continuously improving. Your feedback can help "
295
- "identify model mistakes, usability issues, and opportunities to refine the dataset."
296
- )
297
-
298
- with gr.Row():
299
- with gr.Column():
300
- with gr.Group(elem_classes=["glass-card"]):
301
- fb_type = gr.Dropdown(
302
- ["Bug / technical issue", "Model mistake", "UI suggestion", "Other"],
303
- label="Feedback type"
304
- )
305
- fb_text = gr.Textbox(
306
- lines=6,
307
- label="Your message or example text",
308
- placeholder="Describe the issue or paste an example of text the model misclassified."
309
- )
310
- fb_email = gr.Textbox(
311
- label="Email (optional, for follow‑up)",
312
- placeholder="you@example.com"
313
- )
314
- fb_checkbox = gr.Checkbox(
315
- label="Allow us to use this text anonymously for future model improvements.",
316
- value=True
317
- )
318
- fb_submit = gr.Button("Submit feedback", elem_classes=["btn-primary-custom"])
319
-
320
- with gr.Column():
321
- with gr.Group(elem_classes=["glass-card"]):
322
- fb_status = gr.Markdown("No feedback submitted yet.")
323
- gr.Markdown(
324
- "### FAQ\n"
325
- "**What happens to my feedback?** \n"
326
- "It is stored securely and reviewed by the CMD‑BERT thesis team.\n\n"
327
- "**Will CMD‑BERT replace human fact‑checkers?** \n"
328
- "No. It is a support tool to encourage critical reading.\n\n"
329
- "**Who maintains this tool?** \n"
330
- "The CMD‑BERT thesis team at Cebu Technological University–Main Campus."
331
- )
332
-
333
- def save_feedback(ftype, text, email, consent):
334
- if not text.strip():
335
- return "Please enter a message before submitting."
336
- return "Thank you for your feedback! It has been recorded."
337
-
338
- fb_submit.click(
339
- fn=save_feedback,
340
- inputs=[fb_type, fb_text, fb_email, fb_checkbox],
341
- outputs=fb_status,
342
  )
 
 
 
 
 
 
 
 
343
 
344
 
345
  if __name__ == "__main__":
 
2
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
  import torch
4
 
5
+ # --------------------------
6
+ # Model setup
7
+ # --------------------------
8
  MODEL_ID = "roncc13/trainCMDBERT-sample"
9
 
10
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
 
29
  return {label_names[i]: float(probs[i]) for i in range(len(label_names))}
30
 
31
 
32
+ # --------------------------
33
+ # CSS matching the mockup
34
+ # --------------------------
35
  custom_css = """
36
  body {
37
+ /* Tailwind: bg-gradient-to-br from-indigo-950 via-purple-950 to-slate-900 */
38
+ background: linear-gradient(135deg, #020617 0%, #1e0b45 50%, #020617 100%);
39
  }
40
  .gradio-container {
41
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
42
  "Segoe UI", sans-serif;
43
  max-width: 1120px !important;
44
  margin: 0 auto !important;
45
+ padding: 32px 24px 40px 24px !important;
46
+ color: #f9fafb;
47
  }
48
+
49
+ /* Main cards */
50
  .glass-card {
51
+ background: rgba(15, 23, 42, 0.96); /* near indigo-950 */
52
+ border-radius: 24px;
53
+ border: 1px solid rgba(148, 163, 184, 0.30); /* slate-400 */
54
+ box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
55
  padding: 20px 22px;
 
56
  }
57
+
58
+ /* Header bar: CMD-BERT left, About CMD-BERT right */
59
+ .cmd-header {
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: space-between;
63
+ margin-bottom: 24px;
64
+ }
65
+ .cmd-header-left {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 10px;
69
+ }
70
+ .cmd-logo {
71
+ width: 32px;
72
+ height: 32px;
73
+ border-radius: 999px;
74
+ background: radial-gradient(circle at 30% 30%, #a5b4fc, #6366f1);
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ color: #020617;
79
+ font-weight: 700;
80
+ font-size: 16px;
81
+ }
82
+ .cmd-title {
83
+ font-weight: 600;
84
+ font-size: 14px;
85
+ letter-spacing: 0.08em;
86
+ text-transform: uppercase;
87
+ color: #e5e7eb;
88
+ }
89
+ .cmd-subtitle {
90
+ font-size: 11px;
91
+ color: #9ca3af;
92
+ }
93
+ .cmd-header-right {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 8px;
97
+ font-size: 13px;
98
+ color: #e5e7eb;
99
+ opacity: 0.9;
100
+ }
101
+ .cmd-header-pill {
102
+ width: 24px;
103
+ height: 24px;
104
+ border-radius: 999px;
105
+ background: rgba(148, 163, 184, 0.35);
106
+ }
107
+
108
+ /* Hero text */
109
  .hero-title {
110
+ font-size: 34px;
111
  font-weight: 700;
112
  letter-spacing: 0.02em;
113
  line-height: 1.2;
114
+ color: #e5e7eb;
115
+ margin-bottom: 8px;
116
  }
117
  .hero-subtitle {
118
+ font-size: 14px;
119
+ max-width: 640px;
120
+ opacity: 0.9;
121
+ color: #cbd5f5;
122
  }
123
+
124
+ /* Buttons */
125
  .btn-primary-custom {
126
+ background: linear-gradient(135deg, #22c55e, #16a34a) !important;
127
+ color: #020617 !important;
128
  border-radius: 999px !important;
129
  border: none !important;
130
  padding: 10px 26px !important;
131
  font-weight: 600 !important;
132
+ box-shadow: 0 18px 40px rgba(22, 163, 74, 0.7);
133
  }
134
  .btn-secondary-custom {
135
+ background: transparent !important;
136
+ color: #e5e7eb !important;
137
  border-radius: 999px !important;
138
+ border: 1px solid rgba(148, 163, 184, 0.6) !important;
139
  padding: 10px 22px !important;
140
  font-size: 11px !important;
141
  }
142
+
143
+ /* Confidence bar + label pill */
144
  .conf-bar-bg {
145
+ margin-top: 14px;
146
  width: 100%;
147
  height: 8px;
148
  border-radius: 999px;
149
+ background: rgba(148, 163, 184, 0.35);
150
  }
151
  .conf-bar-fill {
152
  height: 100%;
153
  border-radius: inherit;
154
+ background: linear-gradient(90deg, #f97316, #fb923c);
155
  }
156
  .badge-pill {
157
  display: inline-flex;
158
  align-items: center;
159
  padding: 4px 14px;
160
  border-radius: 999px;
161
+ font-size: 11px;
162
  font-weight: 600;
163
  }
164
  .badge-fake {
165
+ background: #f97316;
166
+ color: #111827;
167
  }
168
  .badge-real {
169
+ background: #22c55e;
170
+ color: #022c22;
171
  }
172
+
173
+ /* Textbox styling */
174
  textarea {
175
+ background: #020617 !important;
176
+ border-radius: 18px !important;
177
+ border: 1px solid rgba(148, 163, 184, 0.35) !important;
178
+ color: #f9fafb !important;
179
  font-size: 13px !important;
180
  }
181
+
182
+ /* Two-column responsiveness */
183
  @media (max-width: 900px) {
184
  .two-col {
185
  flex-direction: column !important;
 
188
  """
189
 
190
 
191
+ # --------------------------
192
+ # UI
193
+ # --------------------------
194
  with gr.Blocks(fill_height=True) as demo:
195
+ # Header bar
196
+ gr.HTML(
197
+ """
198
+ <header class="cmd-header">
199
+ <div class="cmd-header-left">
200
+ <div class="cmd-logo">C</div>
201
+ <div>
202
+ <div class="cmd-title">CMD‑BERT</div>
203
+ <div class="cmd-subtitle">Cebuano Misinformation Detector</div>
204
+ </div>
205
+ </div>
206
+ <div class="cmd-header-right">
207
+ <span>About CMD‑BERT</span>
208
+ <div class="cmd-header-pill"></div>
209
+ </div>
210
+ </header>
211
+ """
212
+ )
 
 
213
 
214
+ # Hero section
215
+ gr.HTML(
216
+ """
217
+ <section style="margin-bottom:22px;">
218
+ <div class="hero-title">
219
+ Check Cebuano text for a misleading writing style.
220
+ </div>
221
+ <div class="hero-subtitle">
222
+ This tool analyzes linguistic patterns and writing style in Cebuano text to detect potential
223
+ misinformation. It does not verify factual correctness. The model returns a classification
224
+ (Fake/Legit) and a confidence score based on writing patterns.
225
+ </div>
226
+ </section>
227
+ """
228
+ )
 
 
 
 
 
 
 
 
 
 
 
229
 
230
+ # Main two-column layout
231
+ with gr.Row(elem_classes=["two-col"], equal_height=True):
232
+ # Left: input card
233
+ with gr.Column(scale=3):
234
+ with gr.Group(elem_classes=["glass-card"]):
235
+ gr.Markdown(
236
+ "#### Text input\n"
237
+ "Cebuano only. This tool checks linguistic patterns; it does not verify facts."
238
+ )
239
+ gr.Markdown(
240
+ "> **Example** \n"
241
+ "> “Nakadisubre og milagro nga tambal sa COVID‑19 ang usa ka local doktor, "
242
+ "giingon nga walay side effects ug dili kinahanglan og bakuna.”"
243
+ )
244
+ news_text = gr.Textbox(
245
+ lines=7,
246
+ label="",
247
+ placeholder="Paste Cebuano news text here..."
248
+ )
249
+ with gr.Row():
250
+ analyze_btn = gr.Button("Analyze", elem_classes=["btn-primary-custom"])
251
+ clear_btn = gr.Button("Clear", elem_classes=["btn-secondary-custom"])
252
+ gr.Markdown(
253
+ "<span style='font-size:11px;opacity:0.8;'>"
254
+ "Tip: Keep inputs under 1,000 characters for faster results."
255
+ "</span>"
256
+ )
257
 
258
+ # Right: result card
259
+ with gr.Column(scale=2):
260
+ with gr.Group(elem_classes=["glass-card"]):
261
+ gr.Markdown("#### Result")
262
+ result_label_html = gr.HTML(
263
+ '<span class="badge-pill badge-fake">FAKE</span>'
264
+ )
265
+ conf_text = gr.HTML(
266
+ '<div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">'
267
+ '<span style="font-size:28px;font-weight:600;" id="conf-val">0.00</span>'
268
+ '<span style="font-size:12px;opacity:0.8;">confidence</span>'
269
+ '</div>'
270
+ )
271
+ conf_bar = gr.HTML(
272
+ '<div class="conf-bar-bg">'
273
+ '<div class="conf-bar-fill" style="width:0%;"></div>'
274
+ '</div>'
275
+ )
276
+ gr.Markdown(
277
+ "<span style='font-size:11px;opacity:0.85;'>"
278
+ "Model: CMD‑BERT (fine‑tuned BERT‑base). "
279
+ "Output: Label and confidence score for the submitted text."
280
+ "</span>"
281
+ )
 
 
282
 
283
+ # Backend → UI glue
284
+ def analyze_ui(text):
285
+ probs = classify(text)
286
+ fake_p = probs.get("fake", 0.0)
287
+ real_p = probs.get("real", 0.0)
288
+ if fake_p >= real_p:
289
+ label = "FAKE"
290
+ css_class = "badge-pill badge-fake"
291
+ conf = fake_p
292
+ else:
293
+ label = "LEGIT"
294
+ css_class = "badge-pill badge-real"
295
+ conf = real_p
296
+ conf_pct = int(conf * 100)
297
+ label_html = f'<span class="{css_class}">{label}</span>'
298
+ conf_html = (
299
+ '<div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">'
300
+ f'<span style="font-size:28px;font-weight:600;" id="conf-val">{conf:.2f}</span>'
301
+ '<span style="font-size:12px;opacity:0.8;">confidence</span>'
302
+ '</div>'
303
  )
304
+ bar_html = (
305
+ '<div class="conf-bar-bg">'
306
+ f'<div class="conf-bar-fill" style="width:{conf_pct}%;"></div>'
307
+ '</div>'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  )
309
+ return label_html, conf_html, bar_html
310
+
311
+ analyze_btn.click(
312
+ fn=analyze_ui,
313
+ inputs=news_text,
314
+ outputs=[result_label_html, conf_text, conf_bar],
315
+ )
316
+ clear_btn.click(fn=lambda: "", inputs=None, outputs=[news_text])
317
 
318
 
319
  if __name__ == "__main__":