rashisht commited on
Commit
f40fa3a
·
verified ·
1 Parent(s): ea29614

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -270,7 +270,9 @@ def merge_boards(boards: list) -> dict:
270
  metric_columns.append({"field": b["id"], "label": _factor_label(b),
271
  "unit": km.get("unit", ""),
272
  "direction": km.get("direction", "desc"),
273
- "description": (b.get("description") or "").strip()})
 
 
274
 
275
  by_model: dict = {}
276
  order: list = []
@@ -468,9 +470,10 @@ TABLE_CSS = """
468
  /* a marker after a pill hangs beside it out of flow (absolute, no offsets =
469
  static position), so starred pills stay centered in line with the column */
470
  .ttslb .pill + .notemark { position:absolute; margin-left:3px; }
471
- /* provider-level markers ride superscript after the model name (.notemark is
472
- already position:relative for its tooltip, so a top offset lifts it) */
473
- .ttslb td.prov .notemark { margin-left:2px; font-size:9.5px; top:-0.45em; }
 
474
  .ttslb .footnotes { margin-top:10px; color:var(--lb-ink-2); font-size:12.5px; line-height:1.7; text-align:left; }
475
  /* the symbol leading each footnote line gets a slight bump so a lone "*" reads */
476
  .ttslb .footnotes .notemark { font-size:1.15em; margin-right:2px; }
@@ -890,12 +893,18 @@ def render_board_html(board: dict, lic: str = "all", fname: str = "board") -> st
890
  ranked, unranked = list(parts), []
891
 
892
  # Footnote markers: one symbol per distinct note among the visible cells — a
 
 
893
  # provider-level note marks the model name (a caveat about the model itself),
894
  # a note on an empty cell explains the gap, and a note on a valued cell flags
895
  # a caveat (e.g. r reported as 0 where zero variance left it undefined).
896
- # Provider notes are collected first so the leftmost column's symbols lead.
897
  _MARKS = ("*", "††", "‡‡", "§§", "‖‖", "¶¶")
898
  marker_of = {}
 
 
 
 
899
  for p in parts:
900
  note = p.get("note")
901
  if note and note not in marker_of:
@@ -922,9 +931,11 @@ def render_board_html(board: dict, lic: str = "all", fname: str = "board") -> st
922
  tip = (c.get("description") or "").strip()
923
  info = (f"<span class='info' data-tip=\"{html.escape(tip, quote=True)}\">ⓘ</span>"
924
  if tip else "")
 
 
925
  ths.append(
926
  f"<th class='num' data-ci='{3 + j}' data-num='1' data-desc='{'1' if d == 'desc' else '0'}'{init}>"
927
- f"{html.escape(c['label'])}<span class='arr'>{arrow}</span>{info}</th>"
928
  )
929
  header = "".join(ths)
930
 
@@ -1073,7 +1084,9 @@ def render_samples_section(samples: list, factor_labels: dict,
1073
  if s.get("scenario"):
1074
  rows_html.append(f"<div class='smp-gnote'><strong>Scenario:"
1075
  f"</strong> {html.escape(s['scenario'])}</div>")
1076
- else:
 
 
1077
  n = sum(1 for r in rows if (r.get("group") or "").strip() == group)
1078
  rows_html.append(f"<div class='smp-group'>{html.escape(group)} "
1079
  f"<span class='smp-n'>({n})</span></div>")
 
270
  metric_columns.append({"field": b["id"], "label": _factor_label(b),
271
  "unit": km.get("unit", ""),
272
  "direction": km.get("direction", "desc"),
273
+ "description": (b.get("description") or "").strip(),
274
+ # a note on the board itself footnotes the header
275
+ "note": (b.get("note") or "").strip()})
276
 
277
  by_model: dict = {}
278
  order: list = []
 
470
  /* a marker after a pill hangs beside it out of flow (absolute, no offsets =
471
  static position), so starred pills stay centered in line with the column */
472
  .ttslb .pill + .notemark { position:absolute; margin-left:3px; }
473
+ /* provider-level and column-header markers ride superscript after their label
474
+ (.notemark is already position:relative for its tooltip, so a top offset
475
+ lifts it) */
476
+ .ttslb td.prov .notemark, .ttslb th .notemark { margin-left:2px; font-size:9.5px; top:-0.45em; }
477
  .ttslb .footnotes { margin-top:10px; color:var(--lb-ink-2); font-size:12.5px; line-height:1.7; text-align:left; }
478
  /* the symbol leading each footnote line gets a slight bump so a lone "*" reads */
479
  .ttslb .footnotes .notemark { font-size:1.15em; margin-right:2px; }
 
893
  ranked, unranked = list(parts), []
894
 
895
  # Footnote markers: one symbol per distinct note among the visible cells — a
896
+ # column-level note marks the header (a caveat about the whole metric, shown
897
+ # without a hover since the header already carries the ⓘ description tip), a
898
  # provider-level note marks the model name (a caveat about the model itself),
899
  # a note on an empty cell explains the gap, and a note on a valued cell flags
900
  # a caveat (e.g. r reported as 0 where zero variance left it undefined).
901
+ # Collection order tracks visual position: headers, then rows, then cells.
902
  _MARKS = ("*", "††", "‡‡", "§§", "‖‖", "¶¶")
903
  marker_of = {}
904
+ for c in value_cols:
905
+ note = c.get("note")
906
+ if note and note not in marker_of:
907
+ marker_of[note] = _MARKS[len(marker_of) % len(_MARKS)]
908
  for p in parts:
909
  note = p.get("note")
910
  if note and note not in marker_of:
 
931
  tip = (c.get("description") or "").strip()
932
  info = (f"<span class='info' data-tip=\"{html.escape(tip, quote=True)}\">ⓘ</span>"
933
  if tip else "")
934
+ hmark = marker_of.get(c.get("note"))
935
+ hmarker = f"<span class='notemark'>{hmark}</span>" if hmark else ""
936
  ths.append(
937
  f"<th class='num' data-ci='{3 + j}' data-num='1' data-desc='{'1' if d == 'desc' else '0'}'{init}>"
938
+ f"{html.escape(c['label'])}{hmarker}<span class='arr'>{arrow}</span>{info}</th>"
939
  )
940
  header = "".join(ths)
941
 
 
1084
  if s.get("scenario"):
1085
  rows_html.append(f"<div class='smp-gnote'><strong>Scenario:"
1086
  f"</strong> {html.escape(s['scenario'])}</div>")
1087
+ elif group != f_label:
1088
+ # a bucket named exactly like its tab would just repeat the
1089
+ # tab label — skip the subheading, keep the grouped rows
1090
  n = sum(1 for r in rows if (r.get("group") or "").strip() == group)
1091
  rows_html.append(f"<div class='smp-group'>{html.escape(group)} "
1092
  f"<span class='smp-n'>({n})</span></div>")