Spaces:
Sleeping
Sleeping
changes to font color
Browse files- app.py +97 -12
- styles.css +72 -14
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
import json
|
| 4 |
import os
|
|
|
|
| 5 |
|
| 6 |
# Load external CSS from the file "styles.css"
|
| 7 |
try:
|
|
@@ -25,6 +26,53 @@ div.gradio-container [class*="block"] .search-panel {
|
|
| 25 |
"""
|
| 26 |
custom_css += additional_css
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
def strip_timestamp(name):
|
| 29 |
"""Remove the timestamp portion from the model name."""
|
| 30 |
parts = name.split('-')
|
|
@@ -314,7 +362,10 @@ def update_leaderboard(selected_mwoz, selected_tau_airline, selected_tau_retail,
|
|
| 314 |
{html_table}
|
| 315 |
"""
|
| 316 |
|
| 317 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
@@ -327,26 +378,50 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
|
|
| 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 |
-
|
| 340 |
-
|
| 341 |
-
if (
|
| 342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
}
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
}
|
| 351 |
});
|
| 352 |
}
|
|
@@ -372,11 +447,19 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
|
|
| 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",
|
|
@@ -384,6 +467,8 @@ with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard") as demo:
|
|
| 384 |
elem_classes="search-input"
|
| 385 |
)
|
| 386 |
|
|
|
|
|
|
|
| 387 |
hidden_sort_state = gr.State(value={"sort_by": "Average Score", "ascending": False})
|
| 388 |
|
| 389 |
# Add sorting buttons
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import json
|
| 4 |
import os
|
| 5 |
+
from gradio.themes.utils import colors
|
| 6 |
|
| 7 |
# Load external CSS from the file "styles.css"
|
| 8 |
try:
|
|
|
|
| 26 |
"""
|
| 27 |
custom_css += additional_css
|
| 28 |
|
| 29 |
+
# Create a custom theme with green for our panels
|
| 30 |
+
class CustomTheme(gr.themes.Base):
|
| 31 |
+
def __init__(self):
|
| 32 |
+
super().__init__(
|
| 33 |
+
primary_hue=colors.red,
|
| 34 |
+
secondary_hue=colors.green,
|
| 35 |
+
neutral_hue=colors.gray,
|
| 36 |
+
text_size=gr.themes.sizes.text_lg
|
| 37 |
+
)
|
| 38 |
+
# Set up theme-level CSS variables
|
| 39 |
+
self.block_background_fill = "transparent"
|
| 40 |
+
self.block_border_width = "0px"
|
| 41 |
+
self.block_shadow = "none"
|
| 42 |
+
# Set color variables for all panel backgrounds
|
| 43 |
+
self.background_fill_secondary = "green" # Used for panels
|
| 44 |
+
|
| 45 |
+
# Add additional CSS for the new styles
|
| 46 |
+
custom_css += """
|
| 47 |
+
/* Override Gradio theme variables */
|
| 48 |
+
:root {
|
| 49 |
+
--block-background-fill: transparent !important;
|
| 50 |
+
--background-fill-primary: transparent !important;
|
| 51 |
+
--background-fill-secondary: transparent !important;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* Target Gradio's internal structure directly */
|
| 55 |
+
.dark .block, .dark .gradio-container, .gradio-container .dark {
|
| 56 |
+
color-scheme: dark;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.block.block.block,
|
| 60 |
+
[id="checkbox-panel"],
|
| 61 |
+
[id="search-panel"],
|
| 62 |
+
[class*="block"] [class*="checkbox-panel"],
|
| 63 |
+
[class*="block"] [class*="search-panel"] {
|
| 64 |
+
background-color: green !important;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/* Force all child elements to be transparent */
|
| 68 |
+
[id="checkbox-panel"] *,
|
| 69 |
+
[id="search-panel"] *,
|
| 70 |
+
.checkbox-panel *,
|
| 71 |
+
.search-panel * {
|
| 72 |
+
background-color: transparent !important;
|
| 73 |
+
}
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
def strip_timestamp(name):
|
| 77 |
"""Remove the timestamp portion from the model name."""
|
| 78 |
parts = name.split('-')
|
|
|
|
| 362 |
{html_table}
|
| 363 |
"""
|
| 364 |
|
| 365 |
+
# Create our custom theme instance
|
| 366 |
+
custom_theme = CustomTheme()
|
| 367 |
+
|
| 368 |
+
with gr.Blocks(css=custom_css, title="TD-EVAL Leaderboard", theme=custom_theme) as demo:
|
| 369 |
gr.Markdown("# 🏆 TD-EVAL Model Evaluation Leaderboard")
|
| 370 |
gr.HTML('<div class="subtitle">This leaderboard displays aggregated model performance across multiple evaluation metrics.</div>')
|
| 371 |
|
|
|
|
| 378 |
var checkboxPanels = document.querySelectorAll('.checkbox-panel');
|
| 379 |
for (var i = 0; i < checkboxPanels.length; i++) {
|
| 380 |
checkboxPanels[i].style.backgroundColor = 'green';
|
| 381 |
+
|
| 382 |
+
// Find ALL child elements and make their backgrounds transparent
|
| 383 |
+
var children = checkboxPanels[i].querySelectorAll('*');
|
| 384 |
+
for (var j = 0; j < children.length; j++) {
|
| 385 |
+
children[j].style.backgroundColor = 'transparent';
|
| 386 |
+
}
|
| 387 |
}
|
| 388 |
|
| 389 |
// Fix search panel
|
| 390 |
var searchPanels = document.querySelectorAll('.search-panel');
|
| 391 |
for (var i = 0; i < searchPanels.length; i++) {
|
| 392 |
searchPanels[i].style.backgroundColor = 'green';
|
| 393 |
+
|
| 394 |
+
// Find ALL child elements and make their backgrounds transparent
|
| 395 |
+
var children = searchPanels[i].querySelectorAll('*');
|
| 396 |
+
for (var j = 0; j < children.length; j++) {
|
| 397 |
+
children[j].style.backgroundColor = 'transparent';
|
| 398 |
+
}
|
| 399 |
}
|
| 400 |
|
| 401 |
// Also try to find parent blocks and set their background
|
| 402 |
+
var blocks = document.querySelectorAll('.block');
|
| 403 |
+
blocks.forEach(function(block) {
|
| 404 |
+
if (block.querySelector('.checkbox-panel') || block.classList.contains('checkbox-panel')) {
|
| 405 |
+
block.style.backgroundColor = 'green';
|
| 406 |
+
|
| 407 |
+
// Make all direct children transparent
|
| 408 |
+
var children = block.children;
|
| 409 |
+
for (var j = 0; j < children.length; j++) {
|
| 410 |
+
if (!children[j].classList.contains('checkbox-panel')) {
|
| 411 |
+
children[j].style.backgroundColor = 'transparent';
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
}
|
| 415 |
+
if (block.querySelector('.search-panel') || block.classList.contains('search-panel')) {
|
| 416 |
+
block.style.backgroundColor = 'green';
|
| 417 |
+
|
| 418 |
+
// Make all direct children transparent
|
| 419 |
+
var children = block.children;
|
| 420 |
+
for (var j = 0; j < children.length; j++) {
|
| 421 |
+
if (!children[j].classList.contains('search-panel')) {
|
| 422 |
+
children[j].style.backgroundColor = 'transparent';
|
| 423 |
+
}
|
| 424 |
+
}
|
| 425 |
}
|
| 426 |
});
|
| 427 |
}
|
|
|
|
| 447 |
</div>
|
| 448 |
''')
|
| 449 |
|
| 450 |
+
# Add a direct HTML wrapper with inline style for the checkboxes
|
| 451 |
+
gr.HTML('<div style="background-color: green; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
|
| 452 |
+
|
| 453 |
with gr.Row(elem_classes="checkbox-panel", elem_id="checkbox-panel"):
|
| 454 |
cb_mwoz = gr.Checkbox(label="mwoz", value=True)
|
| 455 |
cb_tau_airline = gr.Checkbox(label="tau-airline", value=True)
|
| 456 |
cb_tau_retail = gr.Checkbox(label="tau-retail", value=True)
|
| 457 |
+
|
| 458 |
+
gr.HTML('</div>')
|
| 459 |
+
|
| 460 |
+
# Add a direct HTML wrapper with inline style for the search
|
| 461 |
+
gr.HTML('<div style="background-color: green; padding: 12px; border-radius: 6px; margin-bottom: 1rem;">')
|
| 462 |
+
|
| 463 |
with gr.Row(elem_classes="search-panel", elem_id="search-panel"):
|
| 464 |
search_input = gr.Textbox(
|
| 465 |
label="Search models",
|
|
|
|
| 467 |
elem_classes="search-input"
|
| 468 |
)
|
| 469 |
|
| 470 |
+
gr.HTML('</div>')
|
| 471 |
+
|
| 472 |
hidden_sort_state = gr.State(value={"sort_by": "Average Score", "ascending": False})
|
| 473 |
|
| 474 |
# Add sorting buttons
|
styles.css
CHANGED
|
@@ -190,32 +190,90 @@ input[type="text"]:focus {
|
|
| 190 |
Checkbox Panel and Search Panel - High Specificity Rules
|
| 191 |
------------------------------------------------------------------ */
|
| 192 |
|
| 193 |
-
/*
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 208 |
-
div[
|
| 209 |
-
div[class*="row"] div
|
| 210 |
-
|
| 211 |
-
[
|
| 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 |
------------------------------------------------------------------ */
|
|
|
|
| 190 |
Checkbox Panel and Search Panel - High Specificity Rules
|
| 191 |
------------------------------------------------------------------ */
|
| 192 |
|
| 193 |
+
/* Global resets for all panel elements */
|
| 194 |
+
.checkbox-panel *,
|
| 195 |
+
.search-panel * {
|
| 196 |
+
background-color: transparent !important;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/* Target all possible Gradio wrappers for checkbox-panel with maximum specificity */
|
| 200 |
+
body div.gradio-container div[class*="block"] div.checkbox-panel,
|
| 201 |
+
body div.gradio-container [data-testid*="block"] div.checkbox-panel,
|
| 202 |
+
body div.gradio-container [class*="row"] div.checkbox-panel,
|
| 203 |
+
div[class*="gradio-container"] div.checkbox-panel,
|
| 204 |
+
div.gradio-container [class*="row"] div.checkbox-panel,
|
| 205 |
+
div.checkbox-panel,
|
| 206 |
+
.checkbox-panel,
|
| 207 |
+
#checkbox-panel {
|
| 208 |
background-color: green !important;
|
| 209 |
padding: 12px !important;
|
| 210 |
border-radius: 6px !important;
|
| 211 |
margin-bottom: 1rem !important;
|
| 212 |
}
|
| 213 |
|
| 214 |
+
/* Target all possible Gradio wrappers for search-panel with maximum specificity */
|
| 215 |
+
body div.gradio-container div[class*="block"] div.search-panel,
|
| 216 |
+
body div.gradio-container [data-testid*="block"] div.search-panel,
|
| 217 |
+
body div.gradio-container [class*="row"] div.search-panel,
|
| 218 |
+
div[class*="gradio-container"] div.search-panel,
|
| 219 |
+
div.gradio-container [class*="row"] div.search-panel,
|
| 220 |
+
div.search-panel,
|
| 221 |
+
.search-panel,
|
| 222 |
+
#search-panel {
|
| 223 |
background-color: green !important;
|
| 224 |
padding: 12px !important;
|
| 225 |
border-radius: 6px !important;
|
| 226 |
margin-bottom: 1rem !important;
|
| 227 |
}
|
| 228 |
|
| 229 |
+
/* Target gradio blocks that contain our panels */
|
| 230 |
+
div[class*="block"] div.checkbox-panel,
|
| 231 |
+
div.checkbox-panel[class*="block"],
|
| 232 |
+
div[class*="block"].checkbox-panel,
|
| 233 |
+
div[class*="block"] div.search-panel,
|
| 234 |
+
div.search-panel[class*="block"],
|
| 235 |
+
div[class*="block"].search-panel {
|
| 236 |
+
background-color: green !important;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
/* Target the gradio block wrapper directly */
|
| 240 |
+
div[class*="block"][id*="checkbox-panel"],
|
| 241 |
+
div[class*="block"][id*="search-panel"] {
|
| 242 |
+
background-color: green !important;
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
/* Target any div inside these panels to ensure children are transparent */
|
| 246 |
+
.checkbox-panel div,
|
| 247 |
+
.search-panel div {
|
| 248 |
+
background-color: transparent !important;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/* Force all internal container elements to be transparent */
|
| 252 |
+
.checkbox-panel [class*="container"],
|
| 253 |
+
.search-panel [class*="container"],
|
| 254 |
+
.checkbox-panel [class*="wrap"],
|
| 255 |
+
.search-panel [class*="wrap"],
|
| 256 |
+
.checkbox-panel [class*="form"],
|
| 257 |
+
.search-panel [class*="form"] {
|
| 258 |
+
background-color: transparent !important;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/* Additional style overrides for specific Gradio elements */
|
| 262 |
+
.checkbox-panel .form,
|
| 263 |
+
.checkbox-panel .form div,
|
| 264 |
+
.checkbox-panel .block,
|
| 265 |
+
.checkbox-panel .block div,
|
| 266 |
+
.checkbox-panel .container,
|
| 267 |
+
.checkbox-panel .container div,
|
| 268 |
+
.search-panel .form,
|
| 269 |
+
.search-panel .form div,
|
| 270 |
+
.search-panel .block,
|
| 271 |
+
.search-panel .block div,
|
| 272 |
+
.search-panel .container,
|
| 273 |
+
.search-panel .container div {
|
| 274 |
+
background-color: transparent !important;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
/* ------------------------------------------------------------------
|
| 278 |
Override any Gradio-specific styles that might be interfering
|
| 279 |
------------------------------------------------------------------ */
|