Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,84 +59,83 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 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 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
gr.HTML("</div>")
|
| 139 |
-
|
| 140 |
|
| 141 |
# backend → UI glue
|
| 142 |
def analyze_ui(text):
|
|
|
|
| 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 |
# backend → UI glue
|
| 141 |
def analyze_ui(text):
|