Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,6 +157,7 @@ def load_from_dir(
|
|
| 157 |
selected_frameworks: List[str] | None = None,
|
| 158 |
selected_model_types: List[str] | None = None,
|
| 159 |
selected_precisions: List[str] | None = None,
|
|
|
|
| 160 |
force_refresh: bool = False,
|
| 161 |
):
|
| 162 |
try:
|
|
@@ -209,6 +210,13 @@ def load_from_dir(
|
|
| 209 |
lower_selected = [str(x).lower() for x in selected_precisions]
|
| 210 |
df = df[df["Precision"].astype(str).str.lower().isin(lower_selected)]
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
if df.empty:
|
| 213 |
empty_html = "<p>No records found.</p>"
|
| 214 |
return empty_html
|
|
@@ -246,6 +254,7 @@ def auto_refresh_from_dir(
|
|
| 246 |
selected_frameworks: List[str] | None = None,
|
| 247 |
selected_model_types: List[str] | None = None,
|
| 248 |
selected_precisions: List[str] | None = None,
|
|
|
|
| 249 |
):
|
| 250 |
return load_from_dir(
|
| 251 |
dir_path,
|
|
@@ -253,6 +262,7 @@ def auto_refresh_from_dir(
|
|
| 253 |
selected_frameworks=selected_frameworks,
|
| 254 |
selected_model_types=selected_model_types,
|
| 255 |
selected_precisions=selected_precisions,
|
|
|
|
| 256 |
force_refresh=True,
|
| 257 |
)
|
| 258 |
|
|
@@ -280,12 +290,13 @@ def build_app() -> gr.Blocks:
|
|
| 280 |
white-space: nowrap;
|
| 281 |
font-size: 13px;
|
| 282 |
text-align: left;
|
|
|
|
| 283 |
}
|
| 284 |
|
| 285 |
.gradio-container table.metrics-table th {
|
| 286 |
background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
|
| 287 |
font-weight: 600;
|
| 288 |
-
color: #
|
| 289 |
position: sticky;
|
| 290 |
top: 0;
|
| 291 |
z-index: 10;
|
|
@@ -307,12 +318,12 @@ def build_app() -> gr.Blocks:
|
|
| 307 |
}
|
| 308 |
|
| 309 |
.gradio-container table.metrics-table a {
|
| 310 |
-
color: #
|
| 311 |
text-decoration: none;
|
| 312 |
}
|
| 313 |
|
| 314 |
.gradio-container table.metrics-table a:hover {
|
| 315 |
-
color: #
|
| 316 |
text-decoration: underline;
|
| 317 |
}
|
| 318 |
|
|
@@ -336,16 +347,39 @@ def build_app() -> gr.Blocks:
|
|
| 336 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
| 337 |
}
|
| 338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
/* Info section */
|
| 340 |
.info-section {
|
| 341 |
max-height: 400px;
|
| 342 |
overflow-y: auto;
|
| 343 |
padding-right: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
/* Heading styling */
|
| 347 |
.gradio-container h1 {
|
| 348 |
-
color: #
|
| 349 |
font-weight: 700;
|
| 350 |
margin-bottom: 24px;
|
| 351 |
}
|
|
@@ -364,6 +398,13 @@ def build_app() -> gr.Blocks:
|
|
| 364 |
with gr.Row():
|
| 365 |
# Left side - Filters (narrower)
|
| 366 |
with gr.Column(scale=2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
with gr.Group(elem_classes="filter-section"):
|
| 368 |
gr.Markdown("### 🎛️ Filters")
|
| 369 |
|
|
@@ -429,35 +470,41 @@ def build_app() -> gr.Blocks:
|
|
| 429 |
|
| 430 |
demo.load(
|
| 431 |
fn=auto_refresh_from_dir,
|
| 432 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 433 |
outputs=[leaderboard_output],
|
| 434 |
)
|
| 435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
task_filter.change(
|
| 437 |
fn=load_from_dir,
|
| 438 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 439 |
outputs=[leaderboard_output],
|
| 440 |
)
|
| 441 |
framework_filter.change(
|
| 442 |
fn=load_from_dir,
|
| 443 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 444 |
outputs=[leaderboard_output],
|
| 445 |
)
|
| 446 |
model_type_filter.change(
|
| 447 |
fn=load_from_dir,
|
| 448 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 449 |
outputs=[leaderboard_output],
|
| 450 |
)
|
| 451 |
precision_filter.change(
|
| 452 |
fn=load_from_dir,
|
| 453 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 454 |
outputs=[leaderboard_output],
|
| 455 |
)
|
| 456 |
|
| 457 |
timer = gr.Timer(60.0)
|
| 458 |
timer.tick(
|
| 459 |
fn=auto_refresh_from_dir,
|
| 460 |
-
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter],
|
| 461 |
outputs=[leaderboard_output],
|
| 462 |
)
|
| 463 |
|
|
|
|
| 157 |
selected_frameworks: List[str] | None = None,
|
| 158 |
selected_model_types: List[str] | None = None,
|
| 159 |
selected_precisions: List[str] | None = None,
|
| 160 |
+
search_keyword: str = "",
|
| 161 |
force_refresh: bool = False,
|
| 162 |
):
|
| 163 |
try:
|
|
|
|
| 210 |
lower_selected = [str(x).lower() for x in selected_precisions]
|
| 211 |
df = df[df["Precision"].astype(str).str.lower().isin(lower_selected)]
|
| 212 |
|
| 213 |
+
# Search keyword filter - search across all columns
|
| 214 |
+
if search_keyword and search_keyword.strip():
|
| 215 |
+
keyword_lower = search_keyword.strip().lower()
|
| 216 |
+
# Create a mask that checks if the keyword appears in any column
|
| 217 |
+
mask = df.astype(str).apply(lambda row: row.str.lower().str.contains(keyword_lower).any(), axis=1)
|
| 218 |
+
df = df[mask]
|
| 219 |
+
|
| 220 |
if df.empty:
|
| 221 |
empty_html = "<p>No records found.</p>"
|
| 222 |
return empty_html
|
|
|
|
| 254 |
selected_frameworks: List[str] | None = None,
|
| 255 |
selected_model_types: List[str] | None = None,
|
| 256 |
selected_precisions: List[str] | None = None,
|
| 257 |
+
search_keyword: str = "",
|
| 258 |
):
|
| 259 |
return load_from_dir(
|
| 260 |
dir_path,
|
|
|
|
| 262 |
selected_frameworks=selected_frameworks,
|
| 263 |
selected_model_types=selected_model_types,
|
| 264 |
selected_precisions=selected_precisions,
|
| 265 |
+
search_keyword=search_keyword,
|
| 266 |
force_refresh=True,
|
| 267 |
)
|
| 268 |
|
|
|
|
| 290 |
white-space: nowrap;
|
| 291 |
font-size: 13px;
|
| 292 |
text-align: left;
|
| 293 |
+
color: #000000 !important;
|
| 294 |
}
|
| 295 |
|
| 296 |
.gradio-container table.metrics-table th {
|
| 297 |
background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
|
| 298 |
font-weight: 600;
|
| 299 |
+
color: #000000 !important;
|
| 300 |
position: sticky;
|
| 301 |
top: 0;
|
| 302 |
z-index: 10;
|
|
|
|
| 318 |
}
|
| 319 |
|
| 320 |
.gradio-container table.metrics-table a {
|
| 321 |
+
color: #000000 !important;
|
| 322 |
text-decoration: none;
|
| 323 |
}
|
| 324 |
|
| 325 |
.gradio-container table.metrics-table a:hover {
|
| 326 |
+
color: #000000 !important;
|
| 327 |
text-decoration: underline;
|
| 328 |
}
|
| 329 |
|
|
|
|
| 347 |
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
| 348 |
}
|
| 349 |
|
| 350 |
+
/* Accordion styling */
|
| 351 |
+
.gradio-container .accordion {
|
| 352 |
+
background: white !important;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
/* Info section */
|
| 356 |
.info-section {
|
| 357 |
max-height: 400px;
|
| 358 |
overflow-y: auto;
|
| 359 |
padding-right: 10px;
|
| 360 |
+
background: white !important;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
/* Override any dark backgrounds in groups and accordions */
|
| 364 |
+
.gradio-container .group,
|
| 365 |
+
.gradio-container .accordion,
|
| 366 |
+
.gradio-container .panel {
|
| 367 |
+
background-color: white !important;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
/* Search box styling */
|
| 371 |
+
.search-box {
|
| 372 |
+
background: white !important;
|
| 373 |
+
padding: 16px;
|
| 374 |
+
border-radius: 8px;
|
| 375 |
+
border: 1px solid #d1d5db;
|
| 376 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
| 377 |
+
margin-bottom: 16px;
|
| 378 |
}
|
| 379 |
|
| 380 |
/* Heading styling */
|
| 381 |
.gradio-container h1 {
|
| 382 |
+
color: #000000 !important;
|
| 383 |
font-weight: 700;
|
| 384 |
margin-bottom: 24px;
|
| 385 |
}
|
|
|
|
| 398 |
with gr.Row():
|
| 399 |
# Left side - Filters (narrower)
|
| 400 |
with gr.Column(scale=2):
|
| 401 |
+
with gr.Group(elem_classes="search-box"):
|
| 402 |
+
search_input = gr.Textbox(
|
| 403 |
+
label="🔍 Search",
|
| 404 |
+
placeholder="Search across all columns...",
|
| 405 |
+
lines=1
|
| 406 |
+
)
|
| 407 |
+
|
| 408 |
with gr.Group(elem_classes="filter-section"):
|
| 409 |
gr.Markdown("### 🎛️ Filters")
|
| 410 |
|
|
|
|
| 470 |
|
| 471 |
demo.load(
|
| 472 |
fn=auto_refresh_from_dir,
|
| 473 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 474 |
outputs=[leaderboard_output],
|
| 475 |
)
|
| 476 |
|
| 477 |
+
search_input.change(
|
| 478 |
+
fn=load_from_dir,
|
| 479 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 480 |
+
outputs=[leaderboard_output],
|
| 481 |
+
)
|
| 482 |
+
|
| 483 |
task_filter.change(
|
| 484 |
fn=load_from_dir,
|
| 485 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 486 |
outputs=[leaderboard_output],
|
| 487 |
)
|
| 488 |
framework_filter.change(
|
| 489 |
fn=load_from_dir,
|
| 490 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 491 |
outputs=[leaderboard_output],
|
| 492 |
)
|
| 493 |
model_type_filter.change(
|
| 494 |
fn=load_from_dir,
|
| 495 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 496 |
outputs=[leaderboard_output],
|
| 497 |
)
|
| 498 |
precision_filter.change(
|
| 499 |
fn=load_from_dir,
|
| 500 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 501 |
outputs=[leaderboard_output],
|
| 502 |
)
|
| 503 |
|
| 504 |
timer = gr.Timer(60.0)
|
| 505 |
timer.tick(
|
| 506 |
fn=auto_refresh_from_dir,
|
| 507 |
+
inputs=[dir_path, task_filter, framework_filter, model_type_filter, precision_filter, search_input],
|
| 508 |
outputs=[leaderboard_output],
|
| 509 |
)
|
| 510 |
|