md896 commited on
Commit
293388d
1 Parent(s): f4ae3f3

Gradio: fix invisible header and body text on HF dark embed.

Browse files

- Single HTML hero so styling is not split across Column DOM.
- Force light prose/heading colors; fix .sde-section-title (was dark ink on dark bg).
- Container default text color for theme gaps; link and caption tweaks.

Made-with: Cursor

Files changed (1) hide show
  1. server/gradio_ui.py +63 -40
server/gradio_ui.py CHANGED
@@ -69,8 +69,38 @@ GRADIO_CSS = """
69
  radial-gradient(120% 140% at 0% 0%, rgba(45, 212, 191, 0.22) 0%, rgba(45, 212, 191, 0) 52%),
70
  radial-gradient(120% 140% at 100% 0%, rgba(147, 197, 253, 0.22) 0%, rgba(147, 197, 253, 0) 55%),
71
  linear-gradient(132deg, #0f172a 0%, #1e293b 45%, #0f766e 100%);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
- .gradio-container { max-width: 1180px !important; margin-left: auto !important; margin-right: auto !important; }
74
  .sde-hero-wrap {
75
  background: var(--sde-glow);
76
  color: #f8fafc;
@@ -80,34 +110,22 @@ GRADIO_CSS = """
80
  border: 1px solid rgba(148, 163, 184, 0.24);
81
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.12);
82
  }
83
- /* Gradio 5 theme/prose can override colors; keep hero readable. */
84
- .sde-hero-wrap h1,
85
- .sde-hero-wrap .sde-hero-title,
86
- .sde-hero-wrap .prose,
87
- .sde-hero-wrap .prose p,
88
- .sde-hero-wrap .prose h1,
89
- .sde-hero-wrap .markdown,
90
- .sde-hero-wrap .markdown p {
91
- color: #f8fafc !important;
92
- }
93
- .sde-hero-wrap h1,
94
  .sde-hero-wrap .sde-hero-title {
95
  margin: 0 0 0.35rem 0;
96
  font-size: 1.85rem;
97
  font-weight: 800;
98
  letter-spacing: -0.03em;
99
  line-height: 1.2;
 
100
  }
101
- .sde-hero-wrap p,
102
- .sde-hero-wrap .prose p {
103
- margin: 0;
104
  color: #e2e8f0 !important;
105
  font-size: 0.95rem;
106
- line-height: 1.5;
107
  }
108
- .sde-hero-subnav { margin-bottom: 0.75rem; opacity: 0.95; }
109
- .sde-hero-wrap .sde-hero-subnav a,
110
- .sde-hero-wrap .sde-hero-subnav .prose a {
111
  color: #a5f3fc !important;
112
  font-weight: 600;
113
  }
@@ -127,12 +145,16 @@ GRADIO_CSS = """
127
  .sde-section-title {
128
  font-size: 1.05rem;
129
  font-weight: 700;
130
- color: var(--sde-ink);
131
  margin: 1.5rem 0 0.75rem 0;
132
  letter-spacing: -0.02em;
133
  }
 
 
 
 
134
  .sde-link-row a {
135
- color: #2563eb !important;
136
  font-weight: 600;
137
  margin-right: 1rem;
138
  }
@@ -397,24 +419,25 @@ def build_blocks(static_dir: Path) -> Any:
397
  theme=theme,
398
  css=GRADIO_CSS,
399
  ) as demo:
400
- with gr.Column(elem_classes=["sde-hero-wrap"]):
401
- gr.Markdown(
402
- "[HTML demo (main Space page)](/demo) 路 [OpenEnv API](/docs)",
403
- elem_classes=["sde-hero-subnav"],
404
- )
405
- gr.Markdown(
406
- "# SQL Debug Environment\n\n"
407
- "OpenEnv-compliant SQL repair 路 live SQLite rewards 路 TRL / GRPO training on this same Space. "
408
- "One page: benchmarks, artifacts, architecture, and a live playground."
409
- )
410
- gr.Markdown(
411
- '<div class="sde-pill-row">'
412
- '<span class="sde-pill">OpenEnv</span>'
413
- '<span class="sde-pill">FastAPI</span>'
414
- '<span class="sde-pill">Gradio</span>'
415
- '<span class="sde-pill">TRL 路 GRPO</span>'
416
- "</div>"
417
- )
 
418
 
419
  gr.Markdown(
420
  "### First context: training proof first\n"
@@ -554,7 +577,7 @@ def build_blocks(static_dir: Path) -> Any:
554
 
555
  gr.Markdown(
556
  '<p class="sde-section-title">Training run charts (repo static)</p>'
557
- "<span style='color:#64748b;font-size:0.9rem'>Training plots from real runs. Regenerate with `presentation_graphs.py`; commit PNGs under `server/static/`.</span>"
558
  )
559
  with gr.Row():
560
  if proof_combo:
 
69
  radial-gradient(120% 140% at 0% 0%, rgba(45, 212, 191, 0.22) 0%, rgba(45, 212, 191, 0) 52%),
70
  radial-gradient(120% 140% at 100% 0%, rgba(147, 197, 253, 0.22) 0%, rgba(147, 197, 253, 0) 55%),
71
  linear-gradient(132deg, #0f172a 0%, #1e293b 45%, #0f766e 100%);
72
+ /* HF Space embed is often dark; keep prose readable (theme alone used near-black on black). */
73
+ --sde-body-text: #e2e8f0;
74
+ --sde-heading-text: #f8fafc;
75
+ }
76
+ .gradio-container {
77
+ max-width: 1180px !important;
78
+ margin-left: auto !important;
79
+ margin-right: auto !important;
80
+ color: #e2e8f0 !important;
81
+ }
82
+ /* Gradio 5 + HF: markdown / prose defaults can match a dark shell and disappear */
83
+ .gradio-container .prose,
84
+ .gradio-container .prose p,
85
+ .gradio-container .prose li,
86
+ .gradio-container .prose td,
87
+ .gradio-container .prose th {
88
+ color: var(--sde-body-text) !important;
89
+ }
90
+ .gradio-container .prose h1,
91
+ .gradio-container .prose h2,
92
+ .gradio-container .prose h3,
93
+ .gradio-container .prose h4,
94
+ .gradio-container .prose strong {
95
+ color: var(--sde-heading-text) !important;
96
+ }
97
+ .gradio-container .prose a {
98
+ color: #7dd3fc !important;
99
+ }
100
+ .gradio-container .prose code {
101
+ color: #fef3c7 !important;
102
+ background: rgba(15, 23, 42, 0.55) !important;
103
  }
 
104
  .sde-hero-wrap {
105
  background: var(--sde-glow);
106
  color: #f8fafc;
 
110
  border: 1px solid rgba(148, 163, 184, 0.24);
111
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.12);
112
  }
 
 
 
 
 
 
 
 
 
 
 
113
  .sde-hero-wrap .sde-hero-title {
114
  margin: 0 0 0.35rem 0;
115
  font-size: 1.85rem;
116
  font-weight: 800;
117
  letter-spacing: -0.03em;
118
  line-height: 1.2;
119
+ color: #f8fafc !important;
120
  }
121
+ .sde-hero-wrap .sde-hero-lede {
122
+ margin: 0 0 0.5rem 0;
 
123
  color: #e2e8f0 !important;
124
  font-size: 0.95rem;
125
+ line-height: 1.55;
126
  }
127
+ .sde-hero-subnav { margin-bottom: 0.75rem; font-size: 0.88rem; }
128
+ .sde-hero-wrap .sde-hero-subnav a {
 
129
  color: #a5f3fc !important;
130
  font-weight: 600;
131
  }
 
145
  .sde-section-title {
146
  font-size: 1.05rem;
147
  font-weight: 700;
148
+ color: var(--sde-heading-text) !important;
149
  margin: 1.5rem 0 0.75rem 0;
150
  letter-spacing: -0.02em;
151
  }
152
+ .sde-muted-caption {
153
+ color: #94a3b8 !important;
154
+ font-size: 0.9rem;
155
+ }
156
  .sde-link-row a {
157
+ color: #7dd3fc !important;
158
  font-weight: 600;
159
  margin-right: 1rem;
160
  }
 
419
  theme=theme,
420
  css=GRADIO_CSS,
421
  ) as demo:
422
+ gr.HTML(
423
+ """
424
+ <div class="sde-hero-wrap">
425
+ <div class="sde-hero-subnav">
426
+ <a href="/demo">HTML demo (main Space page)</a> 路 <a href="/docs">OpenEnv API</a>
427
+ </div>
428
+ <div class="sde-hero-title">SQL Debug Environment</div>
429
+ <p class="sde-hero-lede">OpenEnv-compliant SQL repair 路 live SQLite rewards 路 TRL / GRPO training on this same Space.
430
+ One page: benchmarks, artifacts, architecture, and a live playground.</p>
431
+ <div class="sde-pill-row">
432
+ <span class="sde-pill">OpenEnv</span>
433
+ <span class="sde-pill">FastAPI</span>
434
+ <span class="sde-pill">Gradio</span>
435
+ <span class="sde-pill">TRL 路 GRPO</span>
436
+ </div>
437
+ </div>
438
+ """.strip(),
439
+ elem_id="sde-hero",
440
+ )
441
 
442
  gr.Markdown(
443
  "### First context: training proof first\n"
 
577
 
578
  gr.Markdown(
579
  '<p class="sde-section-title">Training run charts (repo static)</p>'
580
+ '<span class="sde-muted-caption">Training plots from real runs. Regenerate with `presentation_graphs.py`; commit PNGs under `server/static/`.</span>'
581
  )
582
  with gr.Row():
583
  if proof_combo: