juancauma commited on
Commit
b92da5d
·
1 Parent(s): be68771

changes to font color

Browse files
Files changed (2) hide show
  1. app.py +110 -4
  2. styles.css +66 -103
app.py CHANGED
@@ -4,8 +4,26 @@ import json
4
  import os
5
 
6
  # Load external CSS from the file "styles.css"
7
- with open("styles.css", "r") as f:
8
- custom_css = f.read()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  def strip_timestamp(name):
11
  """Remove the timestamp portion from the model name."""
@@ -300,6 +318,48 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
300
  gr.Markdown("# 🏆 TD-EVAL Model Evaluation Leaderboard")
301
  gr.HTML('<div class="subtitle">This leaderboard displays aggregated model performance across multiple evaluation metrics.</div>')
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  gr.HTML('''
304
  <div class="variants_container">
305
  <div class="variants_title">Variants:</div>
@@ -312,12 +372,12 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
312
  </div>
313
  ''')
314
 
315
- with gr.Row(elem_classes="checkbox-panel"):
316
  cb_mwoz = gr.Checkbox(label="mwoz", value=True)
317
  cb_tau_airline = gr.Checkbox(label="tau-airline", value=True)
318
  cb_tau_retail = gr.Checkbox(label="tau-retail", value=True)
319
 
320
- with gr.Row(elem_classes="search-panel"):
321
  search_input = gr.Textbox(
322
  label="Search models",
323
  placeholder="Type to filter…",
@@ -402,6 +462,52 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
402
  cb_tau_retail.change(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
403
  search_input.change(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  demo.load(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
406
 
407
  if __name__ == "__main__":
 
4
  import os
5
 
6
  # Load external CSS from the file "styles.css"
7
+ try:
8
+ with open("styles.css", "r", encoding="utf-8") as f:
9
+ custom_css = f.read()
10
+ except UnicodeDecodeError:
11
+ # Try with a different encoding if utf-8 fails
12
+ with open("styles.css", "r", encoding="latin-1") as f:
13
+ custom_css = f.read()
14
+
15
+ # Add more specific selector for Gradio and add !important to improve the cascading
16
+ additional_css = """
17
+ .gradio-container .checkbox-panel,
18
+ div.gradio-container [class*="block"] .checkbox-panel {
19
+ background-color: green !important;
20
+ }
21
+ .gradio-container .search-panel,
22
+ div.gradio-container [class*="block"] .search-panel {
23
+ background-color: green !important;
24
+ }
25
+ """
26
+ custom_css += additional_css
27
 
28
  def strip_timestamp(name):
29
  """Remove the timestamp portion from the model name."""
 
318
  gr.Markdown("# 🏆 TD-EVAL Model Evaluation Leaderboard")
319
  gr.HTML('<div class="subtitle">This leaderboard displays aggregated model performance across multiple evaluation metrics.</div>')
320
 
321
+ # Add JavaScript to ensure backgrounds are properly set
322
+ gr.HTML("""
323
+ <script>
324
+ // Function to fix background colors
325
+ function fixBackgrounds() {
326
+ // Fix checkbox panel
327
+ var checkboxPanels = document.querySelectorAll('.checkbox-panel');
328
+ for (var i = 0; i < checkboxPanels.length; i++) {
329
+ checkboxPanels[i].style.backgroundColor = 'green';
330
+ }
331
+
332
+ // Fix search panel
333
+ var searchPanels = document.querySelectorAll('.search-panel');
334
+ for (var i = 0; i < searchPanels.length; i++) {
335
+ searchPanels[i].style.backgroundColor = 'green';
336
+ }
337
+
338
+ // Also try to find parent blocks and set their background
339
+ checkboxPanels.forEach(function(panel) {
340
+ var parent = panel.closest('.block');
341
+ if (parent) {
342
+ parent.style.backgroundColor = 'green';
343
+ }
344
+ });
345
+
346
+ searchPanels.forEach(function(panel) {
347
+ var parent = panel.closest('.block');
348
+ if (parent) {
349
+ parent.style.backgroundColor = 'green';
350
+ }
351
+ });
352
+ }
353
+
354
+ // Run on page load and every second for 5 seconds to catch any delayed rendering
355
+ setTimeout(fixBackgrounds, 500);
356
+ setTimeout(fixBackgrounds, 1000);
357
+ setTimeout(fixBackgrounds, 2000);
358
+ setTimeout(fixBackgrounds, 3000);
359
+ setTimeout(fixBackgrounds, 4000);
360
+ </script>
361
+ """)
362
+
363
  gr.HTML('''
364
  <div class="variants_container">
365
  <div class="variants_title">Variants:</div>
 
372
  </div>
373
  ''')
374
 
375
+ with gr.Row(elem_classes="checkbox-panel", elem_id="checkbox-panel"):
376
  cb_mwoz = gr.Checkbox(label="mwoz", value=True)
377
  cb_tau_airline = gr.Checkbox(label="tau-airline", value=True)
378
  cb_tau_retail = gr.Checkbox(label="tau-retail", value=True)
379
 
380
+ with gr.Row(elem_classes="search-panel", elem_id="search-panel"):
381
  search_input = gr.Textbox(
382
  label="Search models",
383
  placeholder="Type to filter…",
 
462
  cb_tau_retail.change(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
463
  search_input.change(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
464
 
465
+ # Add debug info
466
+ gr.HTML("""
467
+ <div style="margin-top: 50px; border-top: 1px solid #ccc; padding-top: 20px;">
468
+ <h3>Debug Info</h3>
469
+ <p>This panel shows diagnostic information about the UI styling.</p>
470
+ <script>
471
+ function showDebugInfo() {
472
+ // Check for checkbox-panel
473
+ const checkboxPanel = document.querySelector('.checkbox-panel');
474
+ const searchPanel = document.querySelector('.search-panel');
475
+
476
+ let info = "<h4>CSS Classes Investigation</h4>";
477
+
478
+ if (checkboxPanel) {
479
+ const computedStyle = window.getComputedStyle(checkboxPanel);
480
+ info += "<p><strong>Checkbox Panel Background:</strong> " +
481
+ computedStyle.backgroundColor + "</p>";
482
+ info += "<p><strong>Checkbox Panel Classes:</strong> " +
483
+ checkboxPanel.className + "</p>";
484
+ } else {
485
+ info += "<p>Checkbox panel not found</p>";
486
+ }
487
+
488
+ if (searchPanel) {
489
+ const computedStyle = window.getComputedStyle(searchPanel);
490
+ info += "<p><strong>Search Panel Background:</strong> " +
491
+ computedStyle.backgroundColor + "</p>";
492
+ info += "<p><strong>Search Panel Classes:</strong> " +
493
+ searchPanel.className + "</p>";
494
+ } else {
495
+ info += "<p>Search panel not found</p>";
496
+ }
497
+
498
+ document.getElementById('debug-output').innerHTML = info;
499
+ }
500
+
501
+ // Run on page load and every 2 seconds after
502
+ setTimeout(function() {
503
+ showDebugInfo();
504
+ setInterval(showDebugInfo, 2000);
505
+ }, 1000);
506
+ </script>
507
+ <div id="debug-output"></div>
508
+ </div>
509
+ """)
510
+
511
  demo.load(fn=update_leaderboard, inputs=[cb_mwoz, cb_tau_airline, cb_tau_retail, hidden_sort_state, search_input], outputs=leaderboard_display)
512
 
513
  if __name__ == "__main__":
styles.css CHANGED
@@ -186,121 +186,84 @@ input[type="text"]:focus {
186
  margin-top: 20px;
187
  }
188
 
189
- /* ─────────────────────────────────────────────────────────────────────────
190
- the checkbox‐group panel
191
- ─────────────────────────────────────────────────────────────────────── */
192
- .checkbox-panel {
193
- background-color: green !important;
194
- padding: 12px !important;
195
- border-radius: 6px !important;
196
- margin-bottom: 1rem !important; /* give it some breathing room */
197
- }
198
-
199
- .checkbox-panel,
200
- .checkbox-panel * {
201
- color: #FFFFFF !important;
202
- }
203
-
204
- /* ─────────────────────────────────────────────────────────────────────────
205
- the search‐bar panel
206
- ─────────────────────────────────────────────────────────────────────── */
207
- .search-panel {
208
- background-color: green !important;
209
- padding: 12px !important;
210
- border-radius: 6px !important;
211
- margin-bottom: 1rem !important;
212
- }
213
-
214
- .search-panel,
215
- .search-panel * {
216
- color: #FFFFFF !important;
217
- }
218
-
219
- /* make the textbox itself blend with the panel */
220
- .search-panel input[type="text"] {
221
- background-color: transparent !important;
222
- border: 1px solid #FFFFFF !important;
223
- }
224
-
225
- /* lighten the placeholder text so it’s visible */
226
- .search-panel input[type="text"]::placeholder {
227
- color: rgba(255,255,255,0.7) !important;
228
- }
229
-
230
-
231
-
232
-
233
- .checkbox-panel { background-color: green !important; }
234
- .checkbox-panel, .checkbox-panel * { color: #FFF !important; }
235
-
236
- .search-panel { background-color: green !important; }
237
- .search-panel, .search-panel * { color: #FFF !important; }
238
 
239
- /* your existing panel styles */
 
 
 
 
 
240
  .checkbox-panel {
241
  background-color: green !important;
242
  padding: 12px !important;
243
  border-radius: 6px !important;
244
- }
245
- .checkbox-panel, .checkbox-panel * {
246
- color: #FFFFFF !important;
247
- }
248
-
249
- /* make the checkbox “cards” transparent */
250
- .checkbox-panel .checkbox-container {
251
- background-color: transparent !important;
252
- }
253
-
254
- /* similarly for the search bar row */
255
- .search-panel {
256
  background-color: green !important;
257
  padding: 12px !important;
258
  border-radius: 6px !important;
259
- }
260
- .search-panel, .search-panel * {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  color: #FFFFFF !important;
262
- }
263
-
264
- /* strip out Gradio’s default input wrapper */
265
- .search-panel .gr-form-group {
266
- background-color: transparent !important;
267
- }
268
-
269
- /* placeholder styling */
270
- .search-panel .search-input input::placeholder {
271
- color: rgba(255,255,255,0.7) !important;
272
- }
273
-
274
- /* ─── Kill the inner “card” backgrounds ───────────────────────────────────── */
 
 
 
 
275
  .checkbox-panel .block {
276
  background-color: transparent !important;
277
- border: none !important;
278
- box-shadow: none !important;
279
- }
280
-
281
- /* If you ever need to do the same for the search row: */
282
- .search-panel .block {
283
- background-color: transparent !important;
284
- border: none !important;
285
- box-shadow: none !important;
286
- }
287
-
288
 
 
 
 
 
289
 
290
- :root {
291
- --block-background-fill: var(--neutral-800);
292
- }
293
-
294
 
295
- /* at the very end of styles.css */
296
- .checkbox-panel {
297
- --block-background-fill: transparent !important;
298
- }
299
- .search-panel {
300
  --block-background-fill: transparent !important;
301
- }
302
-
303
-
304
- .block {
305
- background-color: red !important;
306
- }
 
186
  margin-top: 20px;
187
  }
188
 
189
+ /* ------------------------------------------------------------------
190
+ Checkbox Panel and Search Panel - High Specificity Rules
191
+ ------------------------------------------------------------------ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
+ /* Target all possible Gradio wrappers for checkbox-panel */
194
+ div[class*="gradio-container"] div[class*="checkbox-panel"],
195
+ div[class*="block"] div[class*="checkbox-panel"],
196
+ div[class*="row"] div[class*="checkbox-panel"],
197
+ .gradio-container .checkbox-panel,
198
+ [data-testid*="row"] .checkbox-panel,
199
  .checkbox-panel {
200
  background-color: green !important;
201
  padding: 12px !important;
202
  border-radius: 6px !important;
203
+ margin-bottom: 1rem !important;
204
+ }
205
+
206
+ /* Target all possible Gradio wrappers for search-panel */
207
+ div[class*="gradio-container"] div[class*="search-panel"],
208
+ div[class*="block"] div[class*="search-panel"],
209
+ div[class*="row"] div[class*="search-panel"],
210
+ .gradio-container .search-panel,
211
+ [data-testid*="row"] .search-panel,
212
+ .search-panel {
 
 
213
  background-color: green !important;
214
  padding: 12px !important;
215
  border-radius: 6px !important;
216
+ margin-bottom: 1rem !important;
217
+ }
218
+
219
+ /* ------------------------------------------------------------------
220
+ Override any Gradio-specific styles that might be interfering
221
+ ------------------------------------------------------------------ */
222
+ .gradio-container [class*="block"] {
223
+ background-color: inherit;
224
+ }
225
+
226
+ /* Force all checkbox-panel descendants to have white text */
227
+ .checkbox-panel,
228
+ .checkbox-panel *,
229
+ .checkbox-panel label,
230
+ .checkbox-panel input,
231
+ .checkbox-panel .label-wrap,
232
+ .checkbox-panel .label-wrap span {
233
  color: #FFFFFF !important;
234
+ }
235
+
236
+ /* Force all search-panel descendants to have white text */
237
+ .search-panel,
238
+ .search-panel *,
239
+ .search-panel label,
240
+ .search-panel input,
241
+ .search-panel .label-wrap,
242
+ .search-panel .label-wrap span {
243
+ color: #FFFFFF !important;
244
+ }
245
+
246
+ /* Make the form elements inside transparent */
247
+ .search-panel input[type="text"],
248
+ .search-panel .gr-form-group,
249
+ .search-panel .block,
250
+ .checkbox-panel .checkbox-container,
251
  .checkbox-panel .block {
252
  background-color: transparent !important;
253
+ }
 
 
 
 
 
 
 
 
 
 
254
 
255
+ /* Make the textbox border white */
256
+ .search-panel input[type="text"] {
257
+ border: 1px solid #FFFFFF !important;
258
+ }
259
 
260
+ /* Lighten the placeholder text */
261
+ .search-panel input[type="text"]::placeholder {
262
+ color: rgba(255,255,255,0.7) !important;
263
+ }
264
 
265
+ /* Root level variable override */
266
+ :root {
 
 
 
267
  --block-background-fill: transparent !important;
268
+ --panel-background-fill: green !important;
269
+ }