MedGRPO Team commited on
Commit ·
16d284c
1
Parent(s): 1db37ad
update
Browse files
app.py
CHANGED
|
@@ -495,7 +495,7 @@ def format_official_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 495 |
display_cols = ["rank", "model_name", "organization"] + metric_keys + ["verified_date"]
|
| 496 |
|
| 497 |
header_map = {
|
| 498 |
-
"rank": "Rank", "model_name": "Model", "organization": "
|
| 499 |
"verified_date": "Verified",
|
| 500 |
}
|
| 501 |
for k in metric_keys:
|
|
@@ -518,16 +518,21 @@ def format_official_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 518 |
metric_second[k] = sorted_vals[1] if len(sorted_vals) >= 2 else None
|
| 519 |
|
| 520 |
html = """<style>
|
| 521 |
-
.off-table {
|
|
|
|
| 522 |
.off-table th { background:#1e3a5f !important; color:#ffffff !important; padding:8px 6px; text-align:center; border-bottom:2px solid #1e3a5f; font-size:0.78rem; position:sticky; top:0; }
|
| 523 |
-
.off-table td { padding:6px; text-align:center; border-bottom:1px solid #e5e7eb; }
|
| 524 |
-
.off-table tr:hover { background:#f0f7ff; }
|
|
|
|
|
|
|
|
|
|
| 525 |
.off-table .model-col { text-align:left; font-weight:500; }
|
|
|
|
| 526 |
.off-table .org-col { text-align:left; color:#6b7280; font-size:0.8rem; }
|
| 527 |
-
.off-table .best-cell { color:#b91c1c; font-weight:700; }
|
| 528 |
-
.off-table .second-cell { color:#b45309; font-weight:600; }
|
| 529 |
</style>
|
| 530 |
-
<div style="overflow-x:auto; max-height:600px; overflow-y:auto;">
|
| 531 |
<table class="off-table">
|
| 532 |
<thead><tr>"""
|
| 533 |
|
|
@@ -537,8 +542,7 @@ def format_official_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 537 |
|
| 538 |
for _, row in df.iterrows():
|
| 539 |
rank = int(row.get('rank', 0))
|
| 540 |
-
|
| 541 |
-
html += f'<tr style="{row_style}">'
|
| 542 |
|
| 543 |
for col in display_cols:
|
| 544 |
val = row.get(col, "")
|
|
@@ -547,7 +551,11 @@ def format_official_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 547 |
badge = rank_badges.get(rank, "")
|
| 548 |
html += f'<td style="white-space:nowrap;">{badge}{rank}</td>'
|
| 549 |
elif col == "model_name":
|
| 550 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
elif col == "organization":
|
| 552 |
html += f'<td class="org-col">{val}</td>'
|
| 553 |
elif col == "verified_date":
|
|
@@ -570,7 +578,8 @@ def format_official_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 570 |
html += """<p style="text-align:center; margin-top:0.5rem; font-size:0.78rem; color:#6b7280;">
|
| 571 |
<span style="color:#b91c1c; font-weight:700;">■ Best</span>
|
| 572 |
<span style="color:#b45309; font-weight:600;">■ 2nd Best</span>
|
| 573 |
-
|
|
|
|
| 574 |
</p>"""
|
| 575 |
|
| 576 |
return html
|
|
@@ -1504,7 +1513,7 @@ def format_leaderboard_display(df: pd.DataFrame) -> pd.DataFrame:
|
|
| 1504 |
elif col == "model_name":
|
| 1505 |
column_names.append("Model")
|
| 1506 |
elif col == "organization":
|
| 1507 |
-
column_names.append("
|
| 1508 |
elif col == "date":
|
| 1509 |
column_names.append("Date")
|
| 1510 |
elif col == "contact":
|
|
@@ -1535,7 +1544,7 @@ def format_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 1535 |
|
| 1536 |
# Column headers
|
| 1537 |
header_map = {
|
| 1538 |
-
"rank": "Rank", "model_name": "Model", "organization": "
|
| 1539 |
}
|
| 1540 |
for k in metric_keys:
|
| 1541 |
header_map[k] = METRICS[k]["name"]
|
|
@@ -1562,16 +1571,21 @@ def format_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 1562 |
|
| 1563 |
# Build HTML
|
| 1564 |
html = """<style>
|
| 1565 |
-
.lb-table {
|
|
|
|
| 1566 |
.lb-table th { background:#f8fafc !important; color:#374151 !important; padding:8px 6px; text-align:center; border-bottom:2px solid #e5e7eb; font-size:0.78rem; position:sticky; top:0; z-index:1; }
|
| 1567 |
-
.lb-table td { padding:6px; text-align:center; border-bottom:1px solid #f3f4f6; }
|
| 1568 |
-
.lb-table tr:hover { background:#f9fafb; }
|
|
|
|
|
|
|
|
|
|
| 1569 |
.lb-table .model-col { text-align:left; font-weight:500; }
|
|
|
|
| 1570 |
.lb-table .org-col { text-align:left; color:#6b7280; font-size:0.8rem; }
|
| 1571 |
-
.lb-table .best-cell { color:#b91c1c; font-weight:700; }
|
| 1572 |
-
.lb-table .second-cell { color:#b45309; font-weight:600; }
|
| 1573 |
</style>
|
| 1574 |
-
<div style="overflow-x:auto; max-height:600px; overflow-y:auto;">
|
| 1575 |
<table class="lb-table">
|
| 1576 |
<thead><tr>"""
|
| 1577 |
|
|
@@ -1581,8 +1595,7 @@ def format_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 1581 |
|
| 1582 |
for _, row in df.iterrows():
|
| 1583 |
rank = int(row.get('rank', 0))
|
| 1584 |
-
|
| 1585 |
-
html += f'<tr style="{row_style}">'
|
| 1586 |
|
| 1587 |
for col in display_cols:
|
| 1588 |
val = row.get(col, "")
|
|
@@ -1592,7 +1605,11 @@ def format_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 1592 |
html += f'<td style="white-space:nowrap;">{badge}{rank}</td>'
|
| 1593 |
|
| 1594 |
elif col == "model_name":
|
| 1595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1596 |
|
| 1597 |
elif col == "organization":
|
| 1598 |
html += f'<td class="org-col">{val}</td>'
|
|
@@ -1620,7 +1637,9 @@ def format_leaderboard_html(df: pd.DataFrame) -> str:
|
|
| 1620 |
html += """<p style="text-align:center; margin-top:0.5rem; font-size:0.78rem; color:#6b7280;">
|
| 1621 |
<span style="color:#b91c1c; font-weight:700;">■ Best</span>
|
| 1622 |
<span style="color:#b45309; font-weight:600;">■ 2nd Best</span>
|
| 1623 |
-
🥇 1st 🥈 2nd 🥉 3rd overall
|
|
|
|
|
|
|
| 1624 |
</p>"""
|
| 1625 |
|
| 1626 |
return html
|
|
|
|
| 495 |
display_cols = ["rank", "model_name", "organization"] + metric_keys + ["verified_date"]
|
| 496 |
|
| 497 |
header_map = {
|
| 498 |
+
"rank": "Rank", "model_name": "Model", "organization": "Team",
|
| 499 |
"verified_date": "Verified",
|
| 500 |
}
|
| 501 |
for k in metric_keys:
|
|
|
|
| 518 |
metric_second[k] = sorted_vals[1] if len(sorted_vals) >= 2 else None
|
| 519 |
|
| 520 |
html = """<style>
|
| 521 |
+
.off-table-wrap { color-scheme: light; background:#ffffff; color:#111827; border-radius:6px; }
|
| 522 |
+
.off-table { width:100%; border-collapse:collapse; font-size:0.85rem; font-family:system-ui,-apple-system,sans-serif; background:#ffffff; color:#111827; }
|
| 523 |
.off-table th { background:#1e3a5f !important; color:#ffffff !important; padding:8px 6px; text-align:center; border-bottom:2px solid #1e3a5f; font-size:0.78rem; position:sticky; top:0; }
|
| 524 |
+
.off-table td { padding:6px; text-align:center; border-bottom:1px solid #e5e7eb; background:#ffffff; color:#111827; }
|
| 525 |
+
.off-table tr:hover td { background:#f0f7ff; }
|
| 526 |
+
.off-table tr[data-rank="1"] td { background:#fef2f2; font-weight:600; }
|
| 527 |
+
.off-table tr[data-rank="2"] td { background:#fffbeb; font-weight:600; }
|
| 528 |
+
.off-table tr[data-rank="3"] td { background:#f0fdf4; font-weight:600; }
|
| 529 |
.off-table .model-col { text-align:left; font-weight:500; }
|
| 530 |
+
.off-table .model-col a { color:#1e3a5f !important; }
|
| 531 |
.off-table .org-col { text-align:left; color:#6b7280; font-size:0.8rem; }
|
| 532 |
+
.off-table .best-cell { color:#b91c1c !important; font-weight:700; }
|
| 533 |
+
.off-table .second-cell { color:#b45309 !important; font-weight:600; }
|
| 534 |
</style>
|
| 535 |
+
<div class="off-table-wrap" style="overflow-x:auto; max-height:600px; overflow-y:auto;">
|
| 536 |
<table class="off-table">
|
| 537 |
<thead><tr>"""
|
| 538 |
|
|
|
|
| 542 |
|
| 543 |
for _, row in df.iterrows():
|
| 544 |
rank = int(row.get('rank', 0))
|
| 545 |
+
html += f'<tr data-rank="{rank}">'
|
|
|
|
| 546 |
|
| 547 |
for col in display_cols:
|
| 548 |
val = row.get(col, "")
|
|
|
|
| 551 |
badge = rank_badges.get(rank, "")
|
| 552 |
html += f'<td style="white-space:nowrap;">{badge}{rank}</td>'
|
| 553 |
elif col == "model_name":
|
| 554 |
+
url = row.get("model_url", "")
|
| 555 |
+
status = row.get("status", "")
|
| 556 |
+
status_badge = {"maintainer_run": "🏷️ ", "api_verified": "✅ "}.get(status, "")
|
| 557 |
+
name_html = f'<a href="{url}" target="_blank" rel="noopener" style="color:#1e3a5f; text-decoration:none; border-bottom:1px dotted #1e3a5f;">{val}</a>' if url else f'{val}'
|
| 558 |
+
html += f'<td class="model-col">{status_badge}{name_html}</td>'
|
| 559 |
elif col == "organization":
|
| 560 |
html += f'<td class="org-col">{val}</td>'
|
| 561 |
elif col == "verified_date":
|
|
|
|
| 578 |
html += """<p style="text-align:center; margin-top:0.5rem; font-size:0.78rem; color:#6b7280;">
|
| 579 |
<span style="color:#b91c1c; font-weight:700;">■ Best</span>
|
| 580 |
<span style="color:#b45309; font-weight:600;">■ 2nd Best</span>
|
| 581 |
+
🏷️ = Evaluation run by benchmark maintainers
|
| 582 |
+
✅ = User submission verified by maintainers via model API
|
| 583 |
</p>"""
|
| 584 |
|
| 585 |
return html
|
|
|
|
| 1513 |
elif col == "model_name":
|
| 1514 |
column_names.append("Model")
|
| 1515 |
elif col == "organization":
|
| 1516 |
+
column_names.append("Team")
|
| 1517 |
elif col == "date":
|
| 1518 |
column_names.append("Date")
|
| 1519 |
elif col == "contact":
|
|
|
|
| 1544 |
|
| 1545 |
# Column headers
|
| 1546 |
header_map = {
|
| 1547 |
+
"rank": "Rank", "model_name": "Model", "organization": "Team", "date": "Date",
|
| 1548 |
}
|
| 1549 |
for k in metric_keys:
|
| 1550 |
header_map[k] = METRICS[k]["name"]
|
|
|
|
| 1571 |
|
| 1572 |
# Build HTML
|
| 1573 |
html = """<style>
|
| 1574 |
+
.lb-table-wrap { color-scheme: light; background:#ffffff; color:#111827; border-radius:6px; }
|
| 1575 |
+
.lb-table { width:100%; border-collapse:collapse; font-size:0.85rem; font-family:system-ui,-apple-system,sans-serif; background:#ffffff; color:#111827; }
|
| 1576 |
.lb-table th { background:#f8fafc !important; color:#374151 !important; padding:8px 6px; text-align:center; border-bottom:2px solid #e5e7eb; font-size:0.78rem; position:sticky; top:0; z-index:1; }
|
| 1577 |
+
.lb-table td { padding:6px; text-align:center; border-bottom:1px solid #f3f4f6; background:#ffffff; color:#111827; }
|
| 1578 |
+
.lb-table tr:hover td { background:#f9fafb; }
|
| 1579 |
+
.lb-table tr[data-rank="1"] td { background:#fef2f2; font-weight:600; }
|
| 1580 |
+
.lb-table tr[data-rank="2"] td { background:#fffbeb; font-weight:600; }
|
| 1581 |
+
.lb-table tr[data-rank="3"] td { background:#f0fdf4; font-weight:600; }
|
| 1582 |
.lb-table .model-col { text-align:left; font-weight:500; }
|
| 1583 |
+
.lb-table .model-col a { color:#1e3a5f !important; }
|
| 1584 |
.lb-table .org-col { text-align:left; color:#6b7280; font-size:0.8rem; }
|
| 1585 |
+
.lb-table .best-cell { color:#b91c1c !important; font-weight:700; }
|
| 1586 |
+
.lb-table .second-cell { color:#b45309 !important; font-weight:600; }
|
| 1587 |
</style>
|
| 1588 |
+
<div class="lb-table-wrap" style="overflow-x:auto; max-height:600px; overflow-y:auto;">
|
| 1589 |
<table class="lb-table">
|
| 1590 |
<thead><tr>"""
|
| 1591 |
|
|
|
|
| 1595 |
|
| 1596 |
for _, row in df.iterrows():
|
| 1597 |
rank = int(row.get('rank', 0))
|
| 1598 |
+
html += f'<tr data-rank="{rank}">'
|
|
|
|
| 1599 |
|
| 1600 |
for col in display_cols:
|
| 1601 |
val = row.get(col, "")
|
|
|
|
| 1605 |
html += f'<td style="white-space:nowrap;">{badge}{rank}</td>'
|
| 1606 |
|
| 1607 |
elif col == "model_name":
|
| 1608 |
+
url = row.get("model_url", "")
|
| 1609 |
+
status = row.get("status", "")
|
| 1610 |
+
status_badge = {"maintainer_run": "🏷️ ", "api_verified": "✅ "}.get(status, "")
|
| 1611 |
+
name_html = f'<a href="{url}" target="_blank" rel="noopener" style="color:#1e3a5f; text-decoration:none; border-bottom:1px dotted #1e3a5f;">{val}</a>' if url else f'{val}'
|
| 1612 |
+
html += f'<td class="model-col">{status_badge}{name_html}</td>'
|
| 1613 |
|
| 1614 |
elif col == "organization":
|
| 1615 |
html += f'<td class="org-col">{val}</td>'
|
|
|
|
| 1637 |
html += """<p style="text-align:center; margin-top:0.5rem; font-size:0.78rem; color:#6b7280;">
|
| 1638 |
<span style="color:#b91c1c; font-weight:700;">■ Best</span>
|
| 1639 |
<span style="color:#b45309; font-weight:600;">■ 2nd Best</span>
|
| 1640 |
+
🥇 1st 🥈 2nd 🥉 3rd overall
|
| 1641 |
+
🏷️ = Evaluation run by benchmark maintainers
|
| 1642 |
+
✅ = User submission verified by maintainers via model API
|
| 1643 |
</p>"""
|
| 1644 |
|
| 1645 |
return html
|