Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,8 +91,8 @@ def prob_to_color(p: float) -> str:
|
|
| 91 |
r = int(245 + (248 - 245) * t)
|
| 92 |
g = int(191 + (80 - 191) * t)
|
| 93 |
b = int(66 + (80 - 66) * t)
|
| 94 |
-
#
|
| 95 |
-
return f"rgba({r}, {g}, {b}, 0.
|
| 96 |
|
| 97 |
|
| 98 |
def border_color(p: float) -> str:
|
|
@@ -124,12 +124,17 @@ def render_heatmap(sentences, scores) -> str:
|
|
| 124 |
pct = int(round(p * 100))
|
| 125 |
safe = html.escape(sent)
|
| 126 |
pieces.append(
|
| 127 |
-
f"<span title='AI likelihood: {pct}%' "
|
| 128 |
-
f"style='background:{bg}
|
| 129 |
-
f"
|
| 130 |
-
f"
|
| 131 |
-
f"
|
| 132 |
-
f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
)
|
| 134 |
|
| 135 |
body = " ".join(pieces)
|
|
@@ -268,6 +273,19 @@ button.secondary, .secondary button {
|
|
| 268 |
border-radius: 10px !important;
|
| 269 |
}
|
| 270 |
footer { display: none !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
"""
|
| 272 |
|
| 273 |
HEADER_HTML = """
|
|
|
|
| 91 |
r = int(245 + (248 - 245) * t)
|
| 92 |
g = int(191 + (80 - 191) * t)
|
| 93 |
b = int(66 + (80 - 66) * t)
|
| 94 |
+
# Higher opacity for a vivid highlight; text is forced light on top.
|
| 95 |
+
return f"rgba({r}, {g}, {b}, 0.42)"
|
| 96 |
|
| 97 |
|
| 98 |
def border_color(p: float) -> str:
|
|
|
|
| 124 |
pct = int(round(p * 100))
|
| 125 |
safe = html.escape(sent)
|
| 126 |
pieces.append(
|
| 127 |
+
f"<span class='awa-sent' title='AI likelihood: {pct}%' "
|
| 128 |
+
f"style='background:{bg} !important; "
|
| 129 |
+
f"border-bottom:2px solid {bd} !important; "
|
| 130 |
+
f"color:#f8fafc !important; "
|
| 131 |
+
f"text-shadow:0 1px 2px rgba(0,0,0,0.65); "
|
| 132 |
+
f"padding:3px 6px; margin:2px 1px; border-radius:5px; "
|
| 133 |
+
f"box-decoration-break:clone; -webkit-box-decoration-break:clone; "
|
| 134 |
+
f"line-height:2.3;'>{safe} "
|
| 135 |
+
f"<span style='font-size:0.72em; color:#f1f5f9 !important; "
|
| 136 |
+
f"font-weight:600; vertical-align:super; "
|
| 137 |
+
f"text-shadow:0 1px 2px rgba(0,0,0,0.7);'>{pct}%</span></span>"
|
| 138 |
)
|
| 139 |
|
| 140 |
body = " ".join(pieces)
|
|
|
|
| 273 |
border-radius: 10px !important;
|
| 274 |
}
|
| 275 |
footer { display: none !important; }
|
| 276 |
+
|
| 277 |
+
/* Force light text inside our custom HTML output — Gradio 6's prose styles
|
| 278 |
+
otherwise darken anything rendered inside gr.HTML. */
|
| 279 |
+
.gradio-container .prose,
|
| 280 |
+
.gradio-container .prose * ,
|
| 281 |
+
.gradio-container .html-container,
|
| 282 |
+
.gradio-container .html-container * {
|
| 283 |
+
color: #e2e8f0 !important;
|
| 284 |
+
}
|
| 285 |
+
.gradio-container .awa-sent,
|
| 286 |
+
.gradio-container .awa-sent * {
|
| 287 |
+
color: #f8fafc !important;
|
| 288 |
+
}
|
| 289 |
"""
|
| 290 |
|
| 291 |
HEADER_HTML = """
|