Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -366,74 +366,54 @@ body,.gradio-container{ color:var(--text); }
|
|
| 366 |
position:sticky;
|
| 367 |
top:0;
|
| 368 |
z-index:1;
|
| 369 |
-
padding:14px 14px;
|
| 370 |
background:linear-gradient(180deg,#fafcff 0%, #f4f8ff 100%);
|
| 371 |
-
|
| 372 |
-
border-bottom:1px solid #e4ebf6;
|
| 373 |
-
font-size:11px;
|
| 374 |
line-height:1.2;
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
color:#6b7a92;
|
| 378 |
font-weight:950;
|
| 379 |
text-align:center;
|
| 380 |
}
|
| 381 |
.benchmark-table thead th:first-child{
|
| 382 |
text-align:left;
|
| 383 |
-
|
| 384 |
-
border-top-left-radius:18px;
|
| 385 |
-
}
|
| 386 |
-
.benchmark-table thead th:last-child{
|
| 387 |
-
border-right:1px solid #e4ebf6;
|
| 388 |
-
border-top-right-radius:18px;
|
| 389 |
}
|
| 390 |
.benchmark-table tbody tr.group-row td{
|
| 391 |
-
padding:
|
| 392 |
text-align:center;
|
| 393 |
-
background:
|
| 394 |
-
|
| 395 |
-
border-bottom:1px solid #dde6f2;
|
| 396 |
-
color:#475569;
|
| 397 |
font-size:12px;
|
| 398 |
line-height:1.2;
|
| 399 |
font-weight:950;
|
| 400 |
text-transform:uppercase;
|
| 401 |
letter-spacing:.12em;
|
| 402 |
}
|
| 403 |
-
.benchmark-table tbody tr.
|
| 404 |
-
|
| 405 |
-
|
| 406 |
}
|
| 407 |
.benchmark-table tbody tr.data-row td{
|
| 408 |
-
padding:
|
| 409 |
-
background:rgba(255,255,255,.
|
| 410 |
-
border-bottom:1px solid #e8eef7;
|
| 411 |
font-size:14px;
|
| 412 |
line-height:1.45;
|
| 413 |
font-weight:700;
|
| 414 |
color:#243247;
|
| 415 |
text-align:center;
|
| 416 |
-
transition:background .16s ease
|
| 417 |
}
|
| 418 |
.benchmark-table tbody tr.data-row td:first-child{
|
| 419 |
text-align:left;
|
| 420 |
-
border-left:1px solid #e8eef7;
|
| 421 |
}
|
| 422 |
-
.benchmark-table tbody tr.data-row
|
| 423 |
-
|
|
|
|
| 424 |
}
|
| 425 |
.benchmark-table tbody tr.data-row:hover td{
|
| 426 |
background:#f8fbff;
|
| 427 |
}
|
| 428 |
-
.benchmark-table tbody tr.data-row:hover td:first-child{
|
| 429 |
-
transform:translateX(2px);
|
| 430 |
-
}
|
| 431 |
-
.benchmark-table tbody tr.data-row:last-child td:first-child{
|
| 432 |
-
border-bottom-left-radius:18px;
|
| 433 |
-
}
|
| 434 |
-
.benchmark-table tbody tr.data-row:last-child td:last-child{
|
| 435 |
-
border-bottom-right-radius:18px;
|
| 436 |
-
}
|
| 437 |
.model-cell{
|
| 438 |
display:flex;
|
| 439 |
flex-direction:column;
|
|
@@ -452,19 +432,6 @@ body,.gradio-container{ color:var(--text); }
|
|
| 452 |
line-height:1.4;
|
| 453 |
font-weight:700;
|
| 454 |
}
|
| 455 |
-
.method-chip{
|
| 456 |
-
display:inline-flex;
|
| 457 |
-
align-items:center;
|
| 458 |
-
justify-content:center;
|
| 459 |
-
border-radius:999px;
|
| 460 |
-
padding:7px 11px;
|
| 461 |
-
background:#f8fafc;
|
| 462 |
-
border:1px solid #e2e8f0;
|
| 463 |
-
color:#475569;
|
| 464 |
-
font-size:12px;
|
| 465 |
-
line-height:1;
|
| 466 |
-
font-weight:800;
|
| 467 |
-
}
|
| 468 |
.metric-value{
|
| 469 |
display:inline-block;
|
| 470 |
min-width:54px;
|
|
@@ -1070,7 +1037,6 @@ def render_leaderboard() -> str:
|
|
| 1070 |
|
| 1071 |
df = eval_results_df.copy()
|
| 1072 |
model_col = _resolve_column_by_aliases(df, ["model", "name"]) or df.columns[0]
|
| 1073 |
-
method_col = _resolve_column_by_aliases(df, ["method", "setting", "approach"])
|
| 1074 |
group_col = _resolve_column_by_aliases(df, ["group", "section", "category", "family"])
|
| 1075 |
org_col = _resolve_column_by_aliases(df, ["organization", "org", "institution"])
|
| 1076 |
note_col = _resolve_column_by_aliases(df, ["notes", "note"])
|
|
@@ -1078,7 +1044,7 @@ def render_leaderboard() -> str:
|
|
| 1078 |
metric_specs = _metric_specs(df)
|
| 1079 |
|
| 1080 |
if not metric_specs:
|
| 1081 |
-
fallback = [c for c in df.columns if c not in {model_col,
|
| 1082 |
metric_specs = [{"col": c, "label": c.replace("_", " ").title(), "direction": "up"} for c in fallback[:5]]
|
| 1083 |
|
| 1084 |
primary = next((m for m in metric_specs if m["direction"] == "up"), metric_specs[0])
|
|
@@ -1113,8 +1079,6 @@ def render_leaderboard() -> str:
|
|
| 1113 |
best_values = _best_metric_values(df, metric_specs)
|
| 1114 |
|
| 1115 |
header_cells = ['<th style="text-align:left;">Model</th>']
|
| 1116 |
-
if method_col:
|
| 1117 |
-
header_cells.append('<th>Method</th>')
|
| 1118 |
for spec in metric_specs:
|
| 1119 |
header_cells.append(f'<th>{escape(spec["label"])}</th>')
|
| 1120 |
|
|
@@ -1131,7 +1095,7 @@ def render_leaderboard() -> str:
|
|
| 1131 |
group_df = df[df[group_col].fillna("").astype(str).str.strip().replace("", "Ungrouped") == group_name]
|
| 1132 |
if group_df.empty:
|
| 1133 |
continue
|
| 1134 |
-
body_rows.append(f'<tr class="group-row"><td colspan="{1 +
|
| 1135 |
for _, row in group_df.iterrows():
|
| 1136 |
model = escape(normalize_text(row.get(model_col, "")).strip() or "—")
|
| 1137 |
org = escape(normalize_text(row.get(org_col, "")).strip()) if org_col else ""
|
|
@@ -1144,9 +1108,6 @@ def render_leaderboard() -> str:
|
|
| 1144 |
if note:
|
| 1145 |
sub_lines.append(f'<div class="model-sub">{note}</div>')
|
| 1146 |
cells = [f'<td><div class="model-cell"><div class="model-main">{model_html}</div>{"".join(sub_lines)}</div></td>']
|
| 1147 |
-
if method_col:
|
| 1148 |
-
method_text = escape(normalize_text(row.get(method_col, "")).strip() or "—")
|
| 1149 |
-
cells.append(f'<td><span class="method-chip">{method_text}</span></td>')
|
| 1150 |
for spec in metric_specs:
|
| 1151 |
display = _format_metric(row.get(spec["col"], ""))
|
| 1152 |
num = to_float(row.get(spec["col"], ""))
|
|
@@ -1159,7 +1120,7 @@ def render_leaderboard() -> str:
|
|
| 1159 |
cells.append(f'<td><span class="{cls}">{display}</span></td>')
|
| 1160 |
body_rows.append(f'<tr class="data-row">{"".join(cells)}</tr>')
|
| 1161 |
else:
|
| 1162 |
-
body_rows.append(f'<tr class="group-row"><td colspan="{1 +
|
| 1163 |
for _, row in sort_df.iterrows():
|
| 1164 |
model = escape(normalize_text(row.get(model_col, "")).strip() or "—")
|
| 1165 |
org = escape(normalize_text(row.get(org_col, "")).strip()) if org_col else ""
|
|
@@ -1172,9 +1133,6 @@ def render_leaderboard() -> str:
|
|
| 1172 |
if note:
|
| 1173 |
sub_lines.append(f'<div class="model-sub">{note}</div>')
|
| 1174 |
cells = [f'<td><div class="model-cell"><div class="model-main">{model_html}</div>{"".join(sub_lines)}</div></td>']
|
| 1175 |
-
if method_col:
|
| 1176 |
-
method_text = escape(normalize_text(row.get(method_col, "")).strip() or "—")
|
| 1177 |
-
cells.append(f'<td><span class="method-chip">{method_text}</span></td>')
|
| 1178 |
for spec in metric_specs:
|
| 1179 |
display = _format_metric(row.get(spec["col"], ""))
|
| 1180 |
num = to_float(row.get(spec["col"], ""))
|
|
|
|
| 366 |
position:sticky;
|
| 367 |
top:0;
|
| 368 |
z-index:1;
|
| 369 |
+
padding:14px 14px 16px;
|
| 370 |
background:linear-gradient(180deg,#fafcff 0%, #f4f8ff 100%);
|
| 371 |
+
font-size:13px;
|
|
|
|
|
|
|
| 372 |
line-height:1.2;
|
| 373 |
+
letter-spacing:.04em;
|
| 374 |
+
color:#475569;
|
|
|
|
| 375 |
font-weight:950;
|
| 376 |
text-align:center;
|
| 377 |
}
|
| 378 |
.benchmark-table thead th:first-child{
|
| 379 |
text-align:left;
|
| 380 |
+
font-size:15px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
}
|
| 382 |
.benchmark-table tbody tr.group-row td{
|
| 383 |
+
padding:14px 14px 10px;
|
| 384 |
text-align:center;
|
| 385 |
+
background:transparent;
|
| 386 |
+
color:#64748b;
|
|
|
|
|
|
|
| 387 |
font-size:12px;
|
| 388 |
line-height:1.2;
|
| 389 |
font-weight:950;
|
| 390 |
text-transform:uppercase;
|
| 391 |
letter-spacing:.12em;
|
| 392 |
}
|
| 393 |
+
.benchmark-table tbody tr.data-row{
|
| 394 |
+
transition:transform .16s ease, filter .16s ease;
|
| 395 |
+
transform-origin:center;
|
| 396 |
}
|
| 397 |
.benchmark-table tbody tr.data-row td{
|
| 398 |
+
padding:15px 14px;
|
| 399 |
+
background:rgba(255,255,255,.92);
|
|
|
|
| 400 |
font-size:14px;
|
| 401 |
line-height:1.45;
|
| 402 |
font-weight:700;
|
| 403 |
color:#243247;
|
| 404 |
text-align:center;
|
| 405 |
+
transition:background .16s ease;
|
| 406 |
}
|
| 407 |
.benchmark-table tbody tr.data-row td:first-child{
|
| 408 |
text-align:left;
|
|
|
|
| 409 |
}
|
| 410 |
+
.benchmark-table tbody tr.data-row:hover{
|
| 411 |
+
transform:scale(1.012);
|
| 412 |
+
filter:drop-shadow(0 10px 20px rgba(15,23,42,.08));
|
| 413 |
}
|
| 414 |
.benchmark-table tbody tr.data-row:hover td{
|
| 415 |
background:#f8fbff;
|
| 416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
.model-cell{
|
| 418 |
display:flex;
|
| 419 |
flex-direction:column;
|
|
|
|
| 432 |
line-height:1.4;
|
| 433 |
font-weight:700;
|
| 434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
.metric-value{
|
| 436 |
display:inline-block;
|
| 437 |
min-width:54px;
|
|
|
|
| 1037 |
|
| 1038 |
df = eval_results_df.copy()
|
| 1039 |
model_col = _resolve_column_by_aliases(df, ["model", "name"]) or df.columns[0]
|
|
|
|
| 1040 |
group_col = _resolve_column_by_aliases(df, ["group", "section", "category", "family"])
|
| 1041 |
org_col = _resolve_column_by_aliases(df, ["organization", "org", "institution"])
|
| 1042 |
note_col = _resolve_column_by_aliases(df, ["notes", "note"])
|
|
|
|
| 1044 |
metric_specs = _metric_specs(df)
|
| 1045 |
|
| 1046 |
if not metric_specs:
|
| 1047 |
+
fallback = [c for c in df.columns if c not in {model_col, group_col, org_col, note_col, link_col}]
|
| 1048 |
metric_specs = [{"col": c, "label": c.replace("_", " ").title(), "direction": "up"} for c in fallback[:5]]
|
| 1049 |
|
| 1050 |
primary = next((m for m in metric_specs if m["direction"] == "up"), metric_specs[0])
|
|
|
|
| 1079 |
best_values = _best_metric_values(df, metric_specs)
|
| 1080 |
|
| 1081 |
header_cells = ['<th style="text-align:left;">Model</th>']
|
|
|
|
|
|
|
| 1082 |
for spec in metric_specs:
|
| 1083 |
header_cells.append(f'<th>{escape(spec["label"])}</th>')
|
| 1084 |
|
|
|
|
| 1095 |
group_df = df[df[group_col].fillna("").astype(str).str.strip().replace("", "Ungrouped") == group_name]
|
| 1096 |
if group_df.empty:
|
| 1097 |
continue
|
| 1098 |
+
body_rows.append(f'<tr class="group-row"><td colspan="{1 + len(metric_specs)}">{escape(group_name)}</td></tr>')
|
| 1099 |
for _, row in group_df.iterrows():
|
| 1100 |
model = escape(normalize_text(row.get(model_col, "")).strip() or "—")
|
| 1101 |
org = escape(normalize_text(row.get(org_col, "")).strip()) if org_col else ""
|
|
|
|
| 1108 |
if note:
|
| 1109 |
sub_lines.append(f'<div class="model-sub">{note}</div>')
|
| 1110 |
cells = [f'<td><div class="model-cell"><div class="model-main">{model_html}</div>{"".join(sub_lines)}</div></td>']
|
|
|
|
|
|
|
|
|
|
| 1111 |
for spec in metric_specs:
|
| 1112 |
display = _format_metric(row.get(spec["col"], ""))
|
| 1113 |
num = to_float(row.get(spec["col"], ""))
|
|
|
|
| 1120 |
cells.append(f'<td><span class="{cls}">{display}</span></td>')
|
| 1121 |
body_rows.append(f'<tr class="data-row">{"".join(cells)}</tr>')
|
| 1122 |
else:
|
| 1123 |
+
body_rows.append(f'<tr class="group-row"><td colspan="{1 + len(metric_specs)}">All Models</td></tr>')
|
| 1124 |
for _, row in sort_df.iterrows():
|
| 1125 |
model = escape(normalize_text(row.get(model_col, "")).strip() or "—")
|
| 1126 |
org = escape(normalize_text(row.get(org_col, "")).strip()) if org_col else ""
|
|
|
|
| 1133 |
if note:
|
| 1134 |
sub_lines.append(f'<div class="model-sub">{note}</div>')
|
| 1135 |
cells = [f'<td><div class="model-cell"><div class="model-main">{model_html}</div>{"".join(sub_lines)}</div></td>']
|
|
|
|
|
|
|
|
|
|
| 1136 |
for spec in metric_specs:
|
| 1137 |
display = _format_metric(row.get(spec["col"], ""))
|
| 1138 |
num = to_float(row.get(spec["col"], ""))
|