SaylorTwift HF Staff commited on
Commit
efe097f
路
verified 路
1 Parent(s): 5cc45e8

Add Latest releases landing tab: recent models with their benchmark suites and source links

Browse files
Files changed (1) hide show
  1. app.py +71 -0
app.py CHANGED
@@ -119,6 +119,12 @@ input.ctl-search, input.tbl-filter { padding: 7px 10px; border: 1px solid var(--
119
  border: 1px solid var(--hair); border-radius: 999px; font-size: 11.5px;
120
  margin: 2px 4px 2px 0; color: var(--muted); white-space: nowrap; }
121
  .chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
 
 
 
 
 
 
122
  .cat-sec { margin: 10px 0 14px; }
123
  .cat-hd { display: flex; align-items: center; gap: 7px; font-size: 13.5px;
124
  font-weight: 600; color: var(--ink); margin-bottom: 6px; }
@@ -460,6 +466,65 @@ def render_hero() -> str:
460
  )
461
 
462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  # ---------------------------------------------------------------------------
464
  # Tab 1: Benchmark popularity
465
  # ---------------------------------------------------------------------------
@@ -775,6 +840,12 @@ DEFAULT_BENCH = "GPQA-Diamond" if "GPQA-Diamond" in ALL_BENCHMARKS else ALL_BENC
775
  with gr.Blocks(title="LLM Benchmark Usage Explorer") as demo:
776
  gr.HTML(render_hero())
777
 
 
 
 
 
 
 
778
  with gr.Tab("馃搳 Popularity & timeline"):
779
  gr.HTML('<p class="tab-note">Which benchmarks are used the most, and when did they first show up?</p>')
780
  with gr.Row():
 
119
  border: 1px solid var(--hair); border-radius: 999px; font-size: 11.5px;
120
  margin: 2px 4px 2px 0; color: var(--muted); white-space: nowrap; }
121
  .chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
122
+ .rel-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
123
+ .rel-name { font-size: 15px; font-weight: 600; color: var(--ink); }
124
+ .rel-meta { color: var(--muted); font-size: 12.5px; margin-left: auto; }
125
+ .rel-chips { margin-top: 8px; }
126
+ .rel-src { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
127
+ .rel-src a { color: var(--accent); }
128
  .cat-sec { margin: 10px 0 14px; }
129
  .cat-hd { display: flex; align-items: center; gap: 7px; font-size: 13.5px;
130
  font-weight: 600; color: var(--ink); margin-bottom: 6px; }
 
466
  )
467
 
468
 
469
+ # ---------------------------------------------------------------------------
470
+ # Tab 0: Latest releases (landing view)
471
+ # ---------------------------------------------------------------------------
472
+ def rel_date(d: pd.Timestamp) -> str:
473
+ days = (pd.Timestamp.now().normalize() - d.normalize()).days
474
+ if days <= 0:
475
+ return "today"
476
+ if days == 1:
477
+ return "yesterday"
478
+ if days < 7:
479
+ return f"{days} days ago"
480
+ if days < 60:
481
+ return f"{days // 7} week{'s' if days >= 14 else ''} ago"
482
+ if days < 365:
483
+ return f"{days // 30} months ago"
484
+ return f"{days // 365} year{'s' if days >= 730 else ''} ago"
485
+
486
+
487
+ MAX_RELEASE_CHIPS = 16
488
+
489
+
490
+ def latest_releases_view(count) -> str:
491
+ recent = MODELS_DF.sort_values("release_date", ascending=False).head(int(count))
492
+ bucket_rank = {b: i for i, b in enumerate(CATEGORY_ORDER)}
493
+ cards = []
494
+ for m in recent.itertuples():
495
+ usage = (
496
+ USAGE_DF[USAGE_DF["model_id"] == m.model_id]
497
+ .drop_duplicates(subset=["benchmark"])
498
+ .sort_values(["bucket", "benchmark"], key=lambda s: s.map(bucket_rank) if s.name == "bucket" else s)
499
+ )
500
+ if usage.empty:
501
+ body = '<div class="card-sub">No benchmark data recorded for this model.</div>'
502
+ else:
503
+ shown = usage.head(MAX_RELEASE_CHIPS)
504
+ chips = "".join(
505
+ f'<span class="chip" title="{esc(r.bucket)} 路 reported category: {esc(r.category)}">'
506
+ f'<i style="background:var(--cat-{esc(r.bucket)})"></i>{esc(r.benchmark)}</span>'
507
+ for r in shown.itertuples()
508
+ )
509
+ if len(usage) > MAX_RELEASE_CHIPS:
510
+ chips += f'<span class="chip">+{len(usage) - MAX_RELEASE_CHIPS} more</span>'
511
+ src = usage.iloc[0]
512
+ body = (
513
+ f'<div class="rel-chips">{chips}</div>'
514
+ f'<div class="rel-src">{len(usage)} benchmarks 路 Source: '
515
+ f'<a href="{esc(src["source_url"])}" target="_blank">{esc(src["source_title"])}</a> '
516
+ f'({esc(src["source_type"])})</div>'
517
+ )
518
+ cards.append(
519
+ f'<div class="card"><div class="rel-hd">'
520
+ f'<span class="rel-name">{esc(m.model_id)}</span>'
521
+ f"{openness_chip(bool(m.is_open))}"
522
+ f'<span class="rel-meta">{esc(m.lab)} 路 {m.release_date.date()} 路 {rel_date(m.release_date)}</span>'
523
+ f"</div>{body}</div>"
524
+ )
525
+ return "".join(cards)
526
+
527
+
528
  # ---------------------------------------------------------------------------
529
  # Tab 1: Benchmark popularity
530
  # ---------------------------------------------------------------------------
 
840
  with gr.Blocks(title="LLM Benchmark Usage Explorer") as demo:
841
  gr.HTML(render_hero())
842
 
843
+ with gr.Tab("馃啎 Latest releases"):
844
+ gr.HTML('<p class="tab-note">The most recent model releases, the benchmarks they report, and where the numbers come from.</p>')
845
+ rel_count_pills = PillGroup(["10", "20", "50"], "10", "Show")
846
+ rel_out = gr.HTML(latest_releases_view("10"))
847
+ rel_count_pills.change(latest_releases_view, rel_count_pills, rel_out)
848
+
849
  with gr.Tab("馃搳 Popularity & timeline"):
850
  gr.HTML('<p class="tab-note">Which benchmarks are used the most, and when did they first show up?</p>')
851
  with gr.Row():