profplate commited on
Commit
bd3af38
·
verified ·
1 Parent(s): 77d9b53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -8
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
- # Low-opacity fill so text stays readable on dark background.
95
- return f"rgba({r}, {g}, {b}, 0.28)"
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}; border-bottom:2px solid {bd}; "
129
- f"padding:2px 4px; margin:1px 2px; border-radius:4px; "
130
- f"line-height:2.1;'>{safe} "
131
- f"<span style='font-size:0.72em; color:#cbd5e1; "
132
- f"vertical-align:super;'>{pct}%</span></span>"
 
 
 
 
 
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 = """