roncc13 commited on
Commit
9d47642
·
verified ·
1 Parent(s): 01b19e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -67
app.py CHANGED
@@ -58,75 +58,85 @@ with gr.Blocks(fill_height=True) as demo:
58
  </section>
59
  """
60
  )
61
-
62
  # Main two-column layout
63
- gr.HTML("<div style='max-width:1120px;margin:0 auto;'>")
64
- with gr.Row(elem_classes=["two-col"], equal_height=True):
65
- # Left: input card
66
- with gr.Column(scale=3):
67
- with gr.Group(elem_classes=["glass-card"]):
68
- card_start()
69
- gr.Markdown(
70
- "#### Text input\n"
71
- "Cebuano only. This tool checks linguistic patterns; it does not verify facts."
72
- )
73
- gr.Markdown(
74
- "> **Example** \n"
75
- "> “Nakadisubre og milagro nga tambal sa COVID‑19 ang usa ka local doktor, "
76
- "giingon nga walay side effects ug dili kinahanglan og bakuna.”"
77
- )
78
- news_text = gr.Textbox(
79
- lines=7,
80
- label="",
81
- placeholder="Paste Cebuano news text here...",
82
- )
83
- with gr.Row():
84
- analyze_btn = gr.Button(
85
- "Analyze", elem_classes=["btn-primary-custom"]
86
- )
87
- clear_btn = gr.Button(
88
- "Clear", elem_classes=["btn-secondary-custom"]
89
- )
90
- gr.Markdown(
91
- "<span style='font-size:11px;opacity:0.8;'>"
92
- "Tip: Keep inputs under 1,000 characters for faster results."
93
- "</span>",
94
- container=False,
95
- )
96
- card_end()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
- # Right: result card
99
- with gr.Column(scale=2):
100
- with gr.Group(elem_classes=["glass-card"]):
101
- card_start()
102
- gr.Markdown("#### Result")
103
- result_label_html = gr.HTML(
104
- '<span class="badge-pill badge-fake">FAKE</span>'
105
- )
106
- conf_text = gr.HTML(
107
- """
108
- <div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">
109
- <span style="font-size:28px;font-weight:600;" id="conf-val">0.00</span>
110
- <span style="font-size:12px;opacity:0.8;">confidence</span>
111
- </div>
112
- """
113
- )
114
- conf_bar = gr.HTML(
115
- """
116
- <div class="conf-bar-bg">
117
- <div class="conf-bar-fill" style="width:0%;"></div>
118
- </div>
119
- """
120
- )
121
- gr.Markdown(
122
- "<span style='font-size:11px;opacity:0.85;'>"
123
- "Model: CMD‑BERT (fine‑tuned BERT‑base). "
124
- "Output: Label and confidence score for the submitted text."
125
- "</span>",
126
- container=False,
127
- )
128
- card_end()
129
- gr.HTML("</div>")
130
 
131
  # backend → UI glue
132
  def analyze_ui(text):
 
58
  </section>
59
  """
60
  )
 
61
  # Main two-column layout
62
+ gr.HTML("<div style='max-width:1120px;margin:0 auto;'>")
63
+ with gr.Row(elem_classes=["two-col"], equal_height=True):
64
+ # Left: input card
65
+ with gr.Column(scale=3):
66
+ with gr.Group(elem_classes=["glass-card"]):
67
+ card_start()
68
+ gr.Markdown(
69
+ "#### Text input\n"
70
+ "Cebuano only. This tool checks linguistic patterns; it does not verify facts."
71
+ )
72
+ gr.Markdown(
73
+ "> **Example** \n"
74
+ "> “Nakadisubre og milagro nga tambal sa COVID‑19 ang usa ka local doktor, "
75
+ "giingon nga walay side effects ug dili kinahanglan og bakuna.”"
76
+ )
77
+
78
+ # give the textbox its own margin inside the card
79
+ gr.HTML("<div style='margin-top:12px;margin-bottom:14px;'>")
80
+ news_text = gr.Textbox(
81
+ lines=7,
82
+ label="",
83
+ placeholder="Paste Cebuano news text here...",
84
+ )
85
+ gr.HTML("</div>")
86
+
87
+ with gr.Row():
88
+ analyze_btn = gr.Button(
89
+ "Analyze", elem_classes=["btn-primary-custom"]
90
+ )
91
+ clear_btn = gr.Button(
92
+ "Clear", elem_classes=["btn-secondary-custom"]
93
+ )
94
+ gr.Markdown(
95
+ "<span style='font-size:11px;opacity:0.8;'>"
96
+ "Tip: Keep inputs under 1,000 characters for faster results."
97
+ "</span>",
98
+ container=False,
99
+ )
100
+ card_end()
101
+
102
+ # Right: result card
103
+ with gr.Column(scale=2):
104
+ with gr.Group(elem_classes=["glass-card"]):
105
+ card_start()
106
+ gr.Markdown("#### Result")
107
+ result_label_html = gr.HTML(
108
+ '<span class="badge-pill badge-fake">FAKE</span>'
109
+ )
110
+ conf_text = gr.HTML(
111
+ """
112
+ <div style="display:flex;align-items:flex-end;gap:6px;margin-top:10px;">
113
+ <span style="font-size:28px;font-weight:600;" id="conf-val">0.00</span>
114
+ <span style="font-size:12px;opacity:0.8;">confidence</span>
115
+ </div>
116
+ """
117
+ )
118
+
119
+ # margin around the confidence bar
120
+ gr.HTML("<div style='margin-top:10px;margin-bottom:10px;'>")
121
+ conf_bar = gr.HTML(
122
+ """
123
+ <div class="conf-bar-bg">
124
+ <div class="conf-bar-fill" style="width:0%;"></div>
125
+ </div>
126
+ """
127
+ )
128
+ gr.HTML("</div>")
129
+
130
+ gr.Markdown(
131
+ "<span style='font-size:11px;opacity:0.85;'>"
132
+ "Model: CMD‑BERT (fine‑tuned BERT‑base). "
133
+ "Output: Label and confidence score for the submitted text."
134
+ "</span>",
135
+ container=False,
136
+ )
137
+ card_end()
138
+ gr.HTML("</div>")
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  # backend → UI glue
142
  def analyze_ui(text):