SVG Benin flag (the emoji rendered as BJ) and much lighter filter chrome
Browse files
app.py
CHANGED
|
@@ -62,10 +62,22 @@ CSS = """
|
|
| 62 |
|
| 63 |
.fb-legend { font-size:.82rem; color:var(--fb-muted); margin:.15rem 0 .9rem; }
|
| 64 |
|
| 65 |
-
/*
|
| 66 |
-
.fb-
|
| 67 |
-
.fb-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
/* Le tableau est large : on le laisse défiler plutôt que compresser. */
|
| 71 |
.fb-table table { font-size:.86rem; }
|
|
@@ -134,6 +146,20 @@ def categorie(r: dict) -> str:
|
|
| 134 |
return "base"
|
| 135 |
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
def pct(x) -> str:
|
| 138 |
return "—" if x is None else f"{float(x) * 100:.1f}"
|
| 139 |
|
|
@@ -233,7 +259,7 @@ def build_table(benchmark_id: str, vue: str, archs: list[str],
|
|
| 233 |
for c in ("maison", "tiers", "base")}
|
| 234 |
meta = (
|
| 235 |
"<div class='fb-meta'>"
|
| 236 |
-
f"<span>
|
| 237 |
f"<span><b>{bench.get('num_utterances', '?')}</b> utterances</span>"
|
| 238 |
f"<span><b>{bench.get('duration_hours', '?')}</b> hours</span>"
|
| 239 |
+ ("<span class='fb-badge'>private test set</span>"
|
|
@@ -498,7 +524,7 @@ def build_ui() -> gr.Blocks:
|
|
| 498 |
gr.HTML(
|
| 499 |
"<div class='fb-head'>"
|
| 500 |
"<p class='fb-title'>Fon<span>Bench</span> "
|
| 501 |
-
"
|
| 502 |
"<p class='fb-sub'>The public speech-recognition leaderboard for "
|
| 503 |
"Fon, a tonal language of Benin</p>"
|
| 504 |
"</div>"
|
|
@@ -506,26 +532,29 @@ def build_ui() -> gr.Blocks:
|
|
| 506 |
|
| 507 |
with gr.Tabs():
|
| 508 |
with gr.Tab("Leaderboard"):
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
meta = gr.HTML()
|
| 531 |
legende = gr.Markdown(elem_classes="fb-legend")
|
|
@@ -595,7 +624,26 @@ def build_ui() -> gr.Blocks:
|
|
| 595 |
return demo
|
| 596 |
|
| 597 |
|
| 598 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
|
| 600 |
# Au niveau du module, pas sous `__main__` : le lanceur de Hugging Face
|
| 601 |
# importe app.py et cherche une variable nommée `demo`.
|
|
|
|
| 62 |
|
| 63 |
.fb-legend { font-size:.82rem; color:var(--fb-muted); margin:.15rem 0 .9rem; }
|
| 64 |
|
| 65 |
+
/* Filtres : compacts, sans panneaux ni pastilles d'étiquette. */
|
| 66 |
+
.fb-filters { gap:.5rem !important; margin-bottom:.5rem; }
|
| 67 |
+
.fb-filters .block { padding:0 !important; }
|
| 68 |
+
.fb-row2 { align-items:center; gap:.6rem !important; }
|
| 69 |
+
|
| 70 |
+
/* Sélecteur de vue : des pastilles cliquables, pas des boutons radio. */
|
| 71 |
+
.fb-views .wrap { gap:.35rem !important; }
|
| 72 |
+
.fb-views label { border-radius:999px !important;
|
| 73 |
+
padding:.32rem .9rem !important; font-weight:600;
|
| 74 |
+
font-size:.86rem; border:1px solid var(--fb-line) !important;
|
| 75 |
+
cursor:pointer; transition:background .12s; }
|
| 76 |
+
.fb-views label:hover { background:rgba(120,120,180,.12) !important; }
|
| 77 |
+
/* Le cercle du radio n'apporte rien à côté de l'état sélectionné : on le
|
| 78 |
+
masque sans le retirer du parcours clavier. */
|
| 79 |
+
.fb-views input[type=radio] { position:absolute; opacity:0;
|
| 80 |
+
width:1px; height:1px; }
|
| 81 |
|
| 82 |
/* Le tableau est large : on le laisse défiler plutôt que compresser. */
|
| 83 |
.fb-table table { font-size:.86rem; }
|
|
|
|
| 146 |
return "base"
|
| 147 |
|
| 148 |
|
| 149 |
+
# Drapeau béninois en SVG : l'emoji 🇧🇯 est une paire d'indicateurs
|
| 150 |
+
# régionaux que Windows ne compose pas — il s'affiche « BJ ».
|
| 151 |
+
def flag(h: int = 15) -> str:
|
| 152 |
+
w = round(h * 1.5)
|
| 153 |
+
return (
|
| 154 |
+
f"<svg viewBox='0 0 30 20' width='{w}' height='{h}' "
|
| 155 |
+
"style='vertical-align:-.12em;border-radius:2px' "
|
| 156 |
+
"role='img' aria-label='Benin'>"
|
| 157 |
+
"<rect width='30' height='20' fill='#FCD116'/>"
|
| 158 |
+
"<rect y='10' width='30' height='10' fill='#E8112D'/>"
|
| 159 |
+
"<rect width='12' height='20' fill='#008751'/></svg>"
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
def pct(x) -> str:
|
| 164 |
return "—" if x is None else f"{float(x) * 100:.1f}"
|
| 165 |
|
|
|
|
| 259 |
for c in ("maison", "tiers", "base")}
|
| 260 |
meta = (
|
| 261 |
"<div class='fb-meta'>"
|
| 262 |
+
f"<span>{flag(13)} <b>{bench.get('name', benchmark_id)}</b></span>"
|
| 263 |
f"<span><b>{bench.get('num_utterances', '?')}</b> utterances</span>"
|
| 264 |
f"<span><b>{bench.get('duration_hours', '?')}</b> hours</span>"
|
| 265 |
+ ("<span class='fb-badge'>private test set</span>"
|
|
|
|
| 524 |
gr.HTML(
|
| 525 |
"<div class='fb-head'>"
|
| 526 |
"<p class='fb-title'>Fon<span>Bench</span> "
|
| 527 |
+
f"{flag(26)}</p>"
|
| 528 |
"<p class='fb-sub'>The public speech-recognition leaderboard for "
|
| 529 |
"Fon, a tonal language of Benin</p>"
|
| 530 |
"</div>"
|
|
|
|
| 532 |
|
| 533 |
with gr.Tabs():
|
| 534 |
with gr.Tab("Leaderboard"):
|
| 535 |
+
# Deux rangées suffisent : les quatre menus ensemble, puis
|
| 536 |
+
# les vues en pastilles. Le filtre le plus utilisé reste
|
| 537 |
+
# visible et à un seul clic.
|
| 538 |
+
with gr.Column(elem_classes="fb-filters"):
|
| 539 |
+
with gr.Row():
|
| 540 |
+
b_sel = gr.Dropdown(choix, value=defaut,
|
| 541 |
+
label="Test set", scale=5)
|
| 542 |
+
tri = gr.Dropdown(
|
| 543 |
+
["Quality (ranking metric)", "Speed (RTFx)",
|
| 544 |
+
"Model size"],
|
| 545 |
+
value="Quality (ranking metric)",
|
| 546 |
+
label="Sort by", scale=3)
|
| 547 |
+
f_arch = gr.Dropdown([], multiselect=True,
|
| 548 |
+
label="Architecture", scale=3)
|
| 549 |
+
f_dec = gr.Dropdown([], multiselect=True,
|
| 550 |
+
label="Decoder", scale=3)
|
| 551 |
+
with gr.Row(elem_classes="fb-row2"):
|
| 552 |
+
f_type = gr.Radio(list(VUES), value="All models",
|
| 553 |
+
show_label=False, container=False,
|
| 554 |
+
elem_classes="fb-views", scale=8)
|
| 555 |
+
f_cont = gr.Checkbox(label="Hide contaminated",
|
| 556 |
+
container=False, scale=2)
|
| 557 |
+
rafraichir = gr.Button("Refresh", size="sm", scale=1)
|
| 558 |
|
| 559 |
meta = gr.HTML()
|
| 560 |
legende = gr.Markdown(elem_classes="fb-legend")
|
|
|
|
| 624 |
return demo
|
| 625 |
|
| 626 |
|
| 627 |
+
# Les étiquettes de champ s'affichaient en pastilles indigo posées sur des
|
| 628 |
+
# panneaux encadrés : trois niveaux de décor pour cinq filtres. On les rend
|
| 629 |
+
# discrètes au niveau du thème plutôt qu'à coups de !important.
|
| 630 |
+
THEME = gr.themes.Soft(primary_hue="indigo", secondary_hue="amber").set(
|
| 631 |
+
block_label_background_fill="transparent",
|
| 632 |
+
block_label_background_fill_dark="transparent",
|
| 633 |
+
block_label_border_width="0px",
|
| 634 |
+
block_label_text_color="*neutral_500",
|
| 635 |
+
block_label_text_color_dark="*neutral_400",
|
| 636 |
+
block_label_text_size="*text_xs",
|
| 637 |
+
block_label_text_weight="600",
|
| 638 |
+
block_background_fill="transparent",
|
| 639 |
+
block_background_fill_dark="transparent",
|
| 640 |
+
block_border_width="0px",
|
| 641 |
+
block_shadow="none",
|
| 642 |
+
panel_background_fill="transparent",
|
| 643 |
+
panel_background_fill_dark="transparent",
|
| 644 |
+
panel_border_width="0px",
|
| 645 |
+
form_gap_width="0px",
|
| 646 |
+
)
|
| 647 |
|
| 648 |
# Au niveau du module, pas sous `__main__` : le lanceur de Hugging Face
|
| 649 |
# importe app.py et cherche une variable nommée `demo`.
|