Spaces:
Paused
Paused
Commit Β·
f2d1c33
1
Parent(s): 54b4fa6
Font color visible
Browse files
app.py
CHANGED
|
@@ -61,28 +61,33 @@ def _render_view(view, token_logprobs, semantic_result, answer):
|
|
| 61 |
# Status banners
|
| 62 |
# ---------------------------------------------------------------------------
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
)
|
| 75 |
-
_STATUS_READY = (
|
| 76 |
-
|
| 77 |
-
"<
|
| 78 |
-
"
|
| 79 |
-
"</div>"
|
| 80 |
)
|
| 81 |
-
_STATUS_FAILED = (
|
| 82 |
-
|
| 83 |
-
"
|
| 84 |
-
"
|
| 85 |
-
"</div>"
|
| 86 |
)
|
| 87 |
|
| 88 |
|
|
@@ -293,12 +298,11 @@ with gr.Blocks(title="Probabot") as demo:
|
|
| 293 |
user_input.submit(fn=None, inputs=None, outputs=None, cancels=_running_pipelines)
|
| 294 |
|
| 295 |
# Manual cancel button: abort the running pipeline and reset the UI.
|
| 296 |
-
_STATUS_CANCELLED = (
|
| 297 |
-
"
|
| 298 |
-
"
|
| 299 |
-
"
|
| 300 |
-
"
|
| 301 |
-
"available via the toggle.</span></div>"
|
| 302 |
)
|
| 303 |
|
| 304 |
def _on_cancel():
|
|
|
|
| 61 |
# Status banners
|
| 62 |
# ---------------------------------------------------------------------------
|
| 63 |
|
| 64 |
+
def _status_banner(icon, text, bg, border, fg):
|
| 65 |
+
# Set the color directly on the text span with !important so Gradio's theme
|
| 66 |
+
# CSS can't override it to a light color.
|
| 67 |
+
return (
|
| 68 |
+
f"<div style='display:flex; align-items:center; gap:10px; padding:8px 12px; "
|
| 69 |
+
f"border-radius:6px; font-size:0.95em; background:{bg}; border:1px solid {border};'>"
|
| 70 |
+
f"<span style='font-size:1.3em;'>{icon}</span>"
|
| 71 |
+
f"<span style='color:{fg} !important; font-weight:500;'>{text}</span>"
|
| 72 |
+
"</div>"
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
_STATUS_COMPUTING = _status_banner(
|
| 77 |
+
"β³",
|
| 78 |
+
"Computing semantic entropy in the background β this may take 30β120 s. "
|
| 79 |
+
"Please wait, or view <strong style='color:#3a2e00 !important;'>Token probability</strong> below.",
|
| 80 |
+
bg="#fff8e1", border="#e0a800", fg="#3a2e00",
|
| 81 |
)
|
| 82 |
+
_STATUS_READY = _status_banner(
|
| 83 |
+
"β
",
|
| 84 |
+
"Semantic entropy ready β click <strong style='color:#0b3d1a !important;'>Show probabilities</strong> to view.",
|
| 85 |
+
bg="#e6f4ea", border="#2e7d32", fg="#0b3d1a",
|
|
|
|
| 86 |
)
|
| 87 |
+
_STATUS_FAILED = _status_banner(
|
| 88 |
+
"β οΈ",
|
| 89 |
+
"Semantic entropy computation failed. Token probability view is still available.",
|
| 90 |
+
bg="#fdecea", border="#c62828", fg="#5c1010",
|
|
|
|
| 91 |
)
|
| 92 |
|
| 93 |
|
|
|
|
| 298 |
user_input.submit(fn=None, inputs=None, outputs=None, cancels=_running_pipelines)
|
| 299 |
|
| 300 |
# Manual cancel button: abort the running pipeline and reset the UI.
|
| 301 |
+
_STATUS_CANCELLED = _status_banner(
|
| 302 |
+
"π",
|
| 303 |
+
"Semantic entropy computation cancelled. Token probability is still "
|
| 304 |
+
"available via the toggle.",
|
| 305 |
+
bg="#f0f0f0", border="#888", fg="#222",
|
|
|
|
| 306 |
)
|
| 307 |
|
| 308 |
def _on_cancel():
|