burnmydays commited on
Commit
ff4bae4
·
verified ·
1 Parent(s): af5cf1e

Refresh to final: hero centerpiece logo, board C:I:O ratio, all polish

Browse files
Files changed (2) hide show
  1. app.py +42 -10
  2. theme.py +21 -6
app.py CHANGED
@@ -34,6 +34,12 @@ def _fmt_int(n):
34
  if abs(n)>=d: return f"{n/d:.2f}{u}"
35
  return str(int(n))
36
 
 
 
 
 
 
 
37
  def _fmt_cost(c):
38
  """Adaptive $/1M: keep sub-cent values legible instead of rounding to $0.00.
39
  e.g. $0.000195 -> $0.0002 (2 sig figs) rather than $0.00."""
@@ -119,7 +125,7 @@ def board_html(extra=None, sort_key="yield"):
119
  '<span class="mb-num">velocity</span><span class="mb-num">leverage</span>'
120
  '<span class="mb-num">$/1M</span>'
121
  '<span class="mb-y">\u03a5 yield</span>'
122
- '<span class="mb-ledger">ledger \u00b7 R\u00b7C\u00b7I\u00b7O</span></div>')
123
  for i,(n,m) in enumerate(rows,1):
124
  y=m["yield"]; you = extra and n==extra[0]
125
  orders=_math.log10(ymax/y) if y>0 else 99
@@ -145,7 +151,7 @@ def board_html(extra=None, sort_key="yield"):
145
  f'<span class="mb-num">{_cost_str(m)}</span>'
146
  f'<span class="mb-y"><span class="mb-bar" style="width:{barpct:.0f}%"></span>'
147
  f'<span class="mb-yval">{y:,.0f}</span></span>'
148
- f'<span class="mb-ledger">R {_fmt_int(m["raw"]["cache_read"])} \u00b7 C {_fmt_int(m["raw"]["cache_create"])} \u00b7 I {_fmt_int(m["raw"]["input"])} \u00b7 O {_fmt_int(m["raw"]["output"])}</span>'
149
  f'</div>')
150
  out.append('</div>')
151
  out.append('<div class="mb-foot">\u03a5 bar is log-scaled \u00b7 MO\u00a7ES leads the field by ~4 orders of magnitude \u00b7 $/1M blended cost (~ = list-price estimate) \u00b7 * = structural estimation \u00b7 volume can\'t buy rank</div>')
@@ -681,7 +687,7 @@ _HOME_SECTIONS = [
681
 
682
  def home_html():
683
  boxes = "".join(
684
- f'<div class="hm-box hm-{accent}">{mini()}'
685
  f'<div class="hm-title">◢ {t}</div>'
686
  f'<div class="hm-sub">{s}</div><div class="hm-desc">{d}</div>'
687
  f'<div class="hm-cta">open the {t} tab →</div></div>'
@@ -689,6 +695,18 @@ def home_html():
689
  )
690
  return f'<div class="hm-grid">{boxes}</div>'
691
 
 
 
 
 
 
 
 
 
 
 
 
 
692
  def home_footer_html():
693
  loom = "https://www.loom.com/share/edc345e2e5164e20aed3acb6436a08c3"
694
  return (
@@ -709,8 +727,22 @@ def home_footer_html():
709
 
710
  # ---------- UI ----------
711
  import os as _os
 
712
  _ON_SPACE = bool(_os.environ.get("SPACE_ID"))
713
 
 
 
 
 
 
 
 
 
 
 
 
 
 
714
  # Ghost/"unminted" card so the right column is never an empty void on first load.
715
  CARD_PLACEHOLDER = (
716
  '<div class="sig-card species-throughput" id="ghost-card">'
@@ -735,16 +767,15 @@ def _build_demo():
735
  with _b:
736
  with gr.Column(elem_id="moses-hero"):
737
  gr.HTML(
738
- "<div style='display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; border-bottom: 2px solid #C4923A; padding: 4px 0 12px; margin-bottom: 10px;'>"
739
  " <div style='text-align: left; flex: none;'>"
740
  " <div style='color: #8a7f68; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 2px;'>Powered by MO\u00a7ES\u2122</div>"
741
  " <h1 style='margin: 0 !important; line-height: 0.9; text-shadow: 0 0 24px rgba(196,146,58,0.25);'>SIGRANK</h1>"
742
  " </div>"
743
- " <div style='text-align: right; color: #E8E0CF; font-size: 14px; font-weight: 600; line-height: 1.5; max-width: 440px; padding-top: 34px;'>"
744
- " Ranking AI operators on performance, production, architecture &amp; cost efficiency. "
745
- " <span style='color:#C4923A;'>Identifying Burners, Builders, and 10\u00d7ers.</span>"
746
- " </div>"
747
  "</div>"
 
748
  )
749
  # full-width live leaderboard scroller (replaces the old static stat strip)
750
  gr.HTML(profile_marquee_html())
@@ -807,11 +838,11 @@ npx ccusage@latest codex --json
807
 
808
  # ---- TAB: Leaders (the board) ----
809
  with gr.Tab("Leaders"):
810
- gr.Markdown("**The ledger doesn't care what you claim.** Ranked by **\u03a5 = (Cache\u00b7Output)/Input\u00b2** \u2014 raw Read\u00b7Create\u00b7In\u00b7Out stacked under each operator. $/1M is blended cost; efficient architecture is also the cheapest.")
811
  rank_by = gr.Radio(list(SORT_LABELS.keys()), value="\u03a5 yield",
812
- label="Rank by", elem_id="rank-by")
813
  lb = gr.HTML(board_html())
814
  rank_by.change(resort_board, rank_by, lb)
 
815
  gr.HTML(metrics_key_html())
816
  gr.Markdown("*Curated corpus \u00b7 pasting scores you live but isn't persisted unless you sign in \u00b7 $/1M is a list-price recompute (~) \u00b7 \\* = structural estimation.*", elem_id="moses-foot")
817
 
@@ -837,6 +868,7 @@ npx ccusage@latest codex --json
837
 
838
  gr.Markdown(elem_id="moses-foot", value="""Four integers in, full ledger out. Architecture is the only variable that matters.
839
  Wild corpus: tokscale.ai footprints \u00b7 MO\u00a7ES row verified ccusage \u00b7 * = structural estimation.""")
 
840
  return _b
841
 
842
  demo = _build_demo()
 
34
  if abs(n)>=d: return f"{n/d:.2f}{u}"
35
  return str(int(n))
36
 
37
+ def _fmt_whole(n):
38
+ """One-decimal K/M/B/T — for the ledger column."""
39
+ for u,d in (("T",1e12),("B",1e9),("M",1e6),("K",1e3)):
40
+ if abs(n)>=d: return f"{n/d:.1f}{u}"
41
+ return str(int(n))
42
+
43
  def _fmt_cost(c):
44
  """Adaptive $/1M: keep sub-cent values legible instead of rounding to $0.00.
45
  e.g. $0.000195 -> $0.0002 (2 sig figs) rather than $0.00."""
 
125
  '<span class="mb-num">velocity</span><span class="mb-num">leverage</span>'
126
  '<span class="mb-num">$/1M</span>'
127
  '<span class="mb-y">\u03a5 yield</span>'
128
+ '<span class="mb-ledger">ratio \u00b7 C:I:O</span></div>')
129
  for i,(n,m) in enumerate(rows,1):
130
  y=m["yield"]; you = extra and n==extra[0]
131
  orders=_math.log10(ymax/y) if y>0 else 99
 
151
  f'<span class="mb-num">{_cost_str(m)}</span>'
152
  f'<span class="mb-y"><span class="mb-bar" style="width:{barpct:.0f}%"></span>'
153
  f'<span class="mb-yval">{y:,.0f}</span></span>'
154
+ f'<span class="mb-ledger">{round((m["raw"]["cache_create"]+m["raw"]["cache_read"])/max(m["raw"]["input"],1))}:1:{round(m["raw"]["output"]/max(m["raw"]["input"],1))}</span>'
155
  f'</div>')
156
  out.append('</div>')
157
  out.append('<div class="mb-foot">\u03a5 bar is log-scaled \u00b7 MO\u00a7ES leads the field by ~4 orders of magnitude \u00b7 $/1M blended cost (~ = list-price estimate) \u00b7 * = structural estimation \u00b7 volume can\'t buy rank</div>')
 
687
 
688
  def home_html():
689
  boxes = "".join(
690
+ f'<div class="hm-box hm-{accent}" data-tab="{t}" role="button" tabindex="0">{mini()}'
691
  f'<div class="hm-title">◢ {t}</div>'
692
  f'<div class="hm-sub">{s}</div><div class="hm-desc">{d}</div>'
693
  f'<div class="hm-cta">open the {t} tab →</div></div>'
 
695
  )
696
  return f'<div class="hm-grid">{boxes}</div>'
697
 
698
+ # Delegated click: clicking a Home mini switches to that tab (Gradio tabs are buttons).
699
+ _TAB_CLICK_JS = """() => {
700
+ document.addEventListener('click', (e) => {
701
+ const box = e.target.closest('.hm-box[data-tab]');
702
+ if (!box) return;
703
+ const name = (box.getAttribute('data-tab') || '').trim().toUpperCase();
704
+ const btn = [...document.querySelectorAll('.tab-container button, .tab-nav button')]
705
+ .find(b => b.textContent.trim().toUpperCase() === name);
706
+ if (btn) btn.click();
707
+ });
708
+ }"""
709
+
710
  def home_footer_html():
711
  loom = "https://www.loom.com/share/edc345e2e5164e20aed3acb6436a08c3"
712
  return (
 
727
 
728
  # ---------- UI ----------
729
  import os as _os
730
+ import base64 as _base64
731
  _ON_SPACE = bool(_os.environ.get("SPACE_ID"))
732
 
733
+ # MO§ES logo (gold § in concentric rings on a dark disc), as a base64 data-URI <img>
734
+ # so it survives Gradio's HTML sanitizer (which strips inline <svg>).
735
+ _LOGO_SVG = (
736
+ "<svg xmlns='http://www.w3.org/2000/svg' width='66' height='66' viewBox='0 0 100 100'>"
737
+ "<circle cx='50' cy='50' r='48' fill='#0F0D0A'/>"
738
+ "<circle cx='50' cy='50' r='44' fill='none' stroke='#C4923A' stroke-width='2'/>"
739
+ "<circle cx='50' cy='50' r='36' fill='none' stroke='#C4923A' stroke-width='1' opacity='0.4'/>"
740
+ "<text x='50' y='54' text-anchor='middle' dominant-baseline='central' "
741
+ "font-family='Georgia, serif' font-size='56' font-weight='700' fill='#C4923A'>§</text>"
742
+ "</svg>"
743
+ )
744
+ _LOGO_DATA_URI = "data:image/svg+xml;base64," + _base64.b64encode(_LOGO_SVG.encode("utf-8")).decode("ascii")
745
+
746
  # Ghost/"unminted" card so the right column is never an empty void on first load.
747
  CARD_PLACEHOLDER = (
748
  '<div class="sig-card species-throughput" id="ghost-card">'
 
767
  with _b:
768
  with gr.Column(elem_id="moses-hero"):
769
  gr.HTML(
770
+ "<div style='position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 84px; padding: 8px 0 12px; border-bottom: 2px solid #C4923A; margin-bottom: 8px;'>"
771
  " <div style='text-align: left; flex: none;'>"
772
  " <div style='color: #8a7f68; font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 2px;'>Powered by MO\u00a7ES\u2122</div>"
773
  " <h1 style='margin: 0 !important; line-height: 0.9; text-shadow: 0 0 24px rgba(196,146,58,0.25);'>SIGRANK</h1>"
774
  " </div>"
775
+ " <div style='position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);'><div class='moses-logo'><span class='ml-s'>§</span></div></div>"
776
+ " <div style='text-align: right; max-width: 400px; color:#E8E0CF; font-size: 15px; font-weight: 600; line-height: 1.4;'>Ranking AI operators on performance, production, architecture &amp; cost efficiency.</div>"
 
 
777
  "</div>"
778
+ "<div style='text-align: center; color:#C4923A; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; margin: 4px 0 10px;'>Identifying Burners, Builders, and 10×ers.</div>"
779
  )
780
  # full-width live leaderboard scroller (replaces the old static stat strip)
781
  gr.HTML(profile_marquee_html())
 
838
 
839
  # ---- TAB: Leaders (the board) ----
840
  with gr.Tab("Leaders"):
 
841
  rank_by = gr.Radio(list(SORT_LABELS.keys()), value="\u03a5 yield",
842
+ show_label=False, elem_id="rank-by")
843
  lb = gr.HTML(board_html())
844
  rank_by.change(resort_board, rank_by, lb)
845
+ gr.Markdown("**The ledger doesn't care what you claim.** Ranked by **\u03a5 = (Cache\u00b7Output)/Input\u00b2**. The ratio column is cache:input:output (input = 1). $/1M is blended cost \u2014 efficient architecture is also the cheapest.")
846
  gr.HTML(metrics_key_html())
847
  gr.Markdown("*Curated corpus \u00b7 pasting scores you live but isn't persisted unless you sign in \u00b7 $/1M is a list-price recompute (~) \u00b7 \\* = structural estimation.*", elem_id="moses-foot")
848
 
 
868
 
869
  gr.Markdown(elem_id="moses-foot", value="""Four integers in, full ledger out. Architecture is the only variable that matters.
870
  Wild corpus: tokscale.ai footprints \u00b7 MO\u00a7ES row verified ccusage \u00b7 * = structural estimation.""")
871
+ _b.load(None, None, None, js=_TAB_CLICK_JS) # make Home minis clickable \u2192 tab switch
872
  return _b
873
 
874
  demo = _build_demo()
theme.py CHANGED
@@ -89,9 +89,13 @@ button.primary:hover, #compute-btn:hover { background: #d8a449 !important; }
89
  #moses-foot { border-top: 1px solid var(--moses-line); padding-top: 10px; margin-top: 16px; line-height: 1.7; }
90
 
91
  /* Structural Board Alignment Layout */
92
- .moses-board { font-family: ui-monospace, monospace; margin-top: 6px; width: 100% !important; box-sizing: border-box !important; }
93
- .mb-head, .mb-row { display: grid; grid-template-columns: 26px 0.95fr 0.5fr 0.55fr 0.5fr 0.55fr 0.5fr 0.9fr 1.5fr;
 
94
  align-items: center; gap: 8px; padding: 7px 12px; width: 100%; box-sizing: border-box; }
 
 
 
95
  .mb-ledger { color: #7a7060; font-size: 10px; font-family: ui-monospace, monospace; text-align: right;
96
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 1px solid #2c2718; padding-left: 8px; }
97
  .mb-head .mb-ledger { color: #C4923A; }
@@ -121,7 +125,8 @@ button.primary:hover, #compute-btn:hover { background: #d8a449 !important; }
121
  .mb-row b { color: #E8E0CF; font-family: var(--font-sans, sans-serif); font-size: 13px; }
122
  .mb-raw { color: #7a7060; font-size: 9.5px; }
123
  .mb-num { text-align: right; }
124
- .mb-y { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 20px; }
 
125
  .mb-bar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 14px;
126
  background: linear-gradient(90deg, rgba(196,146,58,0.28), rgba(196,146,58,0.72)); border-radius: 2px; }
127
  .mb-row.you .mb-bar { background: linear-gradient(90deg, rgba(196,146,58,0.4), #C4923A); }
@@ -170,7 +175,7 @@ button.primary:hover, #compute-btn:hover { background: #d8a449 !important; }
170
  .pm-lev { color: var(--moses-dim); font-size: 10px; }
171
 
172
  .hm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
173
- .hm-box { border: 1px solid var(--moses-line); border-radius: 6px; background: var(--moses-card);
174
  padding: 16px 18px; transition: border-color 0.12s ease, background 0.12s ease; }
175
  .hm-box:hover { border-color: var(--moses-gold); background: rgba(196,146,58,0.06); }
176
  .hm-title { color: var(--moses-gold); font-size: 15px; font-weight: 800; letter-spacing: 0.04em; }
@@ -313,6 +318,15 @@ button.primary:hover, #compute-btn:hover { background: #d8a449 !important; }
313
  max-width: 760px; margin: 16px auto 0; }
314
  @media (max-width: 700px) { .mx-cols { grid-template-columns: 1fr; } .mx-analogy { font-size: 13px; } }
315
 
 
 
 
 
 
 
 
 
 
316
  /* ---------- middle nav link (Leaders) emphasized ---------- */
317
  .tab-container > button:nth-child(3), .tab-nav > button:nth-child(3) {
318
  color: var(--moses-gold) !important; font-size: 17px !important; font-weight: 800 !important;
@@ -447,10 +461,11 @@ button.primary:hover, #compute-btn:hover { background: #d8a449 !important; }
447
 
448
  /* "Rank by" radio -> horizontal pill / segmented control (not a gray form) */
449
  #rank-by { border: none !important; background: transparent !important; padding: 0 !important; }
450
- #rank-by .wrap { display: flex !important; flex-wrap: wrap; gap: 6px; }
451
  #rank-by .wrap label {
 
452
  background: var(--moses-card); border: 1px solid var(--moses-line);
453
- border-radius: 16px; padding: 4px 12px; color: var(--moses-dim);
454
  font-size: 11px; cursor: pointer; margin: 0 !important; }
455
  #rank-by .wrap label.selected, #rank-by .wrap label:has(input:checked) {
456
  border-color: var(--moses-gold) !important; color: var(--moses-gold) !important;
 
89
  #moses-foot { border-top: 1px solid var(--moses-line); padding-top: 10px; margin-top: 16px; line-height: 1.7; }
90
 
91
  /* Structural Board Alignment Layout */
92
+ .moses-board { font-family: ui-monospace, monospace; margin-top: 6px; width: 100% !important; box-sizing: border-box !important;
93
+ border: 1px solid var(--moses-line); border-radius: 8px; overflow: hidden; }
94
+ .mb-head, .mb-row { display: grid; grid-template-columns: 26px 1.5fr 0.5fr 0.55fr 0.5fr 0.55fr 0.5fr 0.6fr 0.85fr;
95
  align-items: center; gap: 8px; padding: 7px 12px; width: 100%; box-sizing: border-box; }
96
+ .mb-head > span, .mb-row > span { min-width: 0; } /* let cells shrink so nothing overflows */
97
+ .mb-row b { font-size: 12px !important; }
98
+ .mb-op b { white-space: nowrap; }
99
  .mb-ledger { color: #7a7060; font-size: 10px; font-family: ui-monospace, monospace; text-align: right;
100
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 1px solid #2c2718; padding-left: 8px; }
101
  .mb-head .mb-ledger { color: #C4923A; }
 
125
  .mb-row b { color: #E8E0CF; font-family: var(--font-sans, sans-serif); font-size: 13px; }
126
  .mb-raw { color: #7a7060; font-size: 9.5px; }
127
  .mb-num { text-align: right; }
128
+ .mb-y { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 6px;
129
+ min-height: 20px; overflow: hidden; border-radius: 3px; }
130
  .mb-bar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 14px;
131
  background: linear-gradient(90deg, rgba(196,146,58,0.28), rgba(196,146,58,0.72)); border-radius: 2px; }
132
  .mb-row.you .mb-bar { background: linear-gradient(90deg, rgba(196,146,58,0.4), #C4923A); }
 
175
  .pm-lev { color: var(--moses-dim); font-size: 10px; }
176
 
177
  .hm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
178
+ .hm-box { cursor: pointer; border: 1px solid var(--moses-line); border-radius: 6px; background: var(--moses-card);
179
  padding: 16px 18px; transition: border-color 0.12s ease, background 0.12s ease; }
180
  .hm-box:hover { border-color: var(--moses-gold); background: rgba(196,146,58,0.06); }
181
  .hm-title { color: var(--moses-gold); font-size: 15px; font-weight: 800; letter-spacing: 0.04em; }
 
318
  max-width: 760px; margin: 16px auto 0; }
319
  @media (max-width: 700px) { .mx-cols { grid-template-columns: 1fr; } .mx-analogy { font-size: 13px; } }
320
 
321
+ /* ---------- MO§ES logo (CSS-drawn: gold § in concentric rings on a dark disc) ---------- */
322
+ .moses-logo { position: relative; width: 82px; height: 82px; border-radius: 50%;
323
+ background: #0F0D0A; border: 2px solid var(--moses-gold); display: flex;
324
+ align-items: center; justify-content: center; box-shadow: 0 0 18px rgba(196,146,58,0.45); }
325
+ .moses-logo::before { content: ''; position: absolute; inset: 6px; border-radius: 50%;
326
+ border: 1px solid rgba(196,146,58,0.4); }
327
+ .ml-s { color: var(--moses-gold); font-family: Georgia, "Times New Roman", serif;
328
+ font-size: 48px; font-weight: 700; line-height: 1; }
329
+
330
  /* ---------- middle nav link (Leaders) emphasized ---------- */
331
  .tab-container > button:nth-child(3), .tab-nav > button:nth-child(3) {
332
  color: var(--moses-gold) !important; font-size: 17px !important; font-weight: 800 !important;
 
461
 
462
  /* "Rank by" radio -> horizontal pill / segmented control (not a gray form) */
463
  #rank-by { border: none !important; background: transparent !important; padding: 0 !important; }
464
+ #rank-by .wrap { display: flex !important; flex-wrap: wrap; gap: 6px; justify-content: center !important; }
465
  #rank-by .wrap label {
466
+ flex: 1 1 0; max-width: 150px; text-align: center;
467
  background: var(--moses-card); border: 1px solid var(--moses-line);
468
+ border-radius: 16px; padding: 5px 12px; color: var(--moses-dim);
469
  font-size: 11px; cursor: pointer; margin: 0 !important; }
470
  #rank-by .wrap label.selected, #rank-by .wrap label:has(input:checked) {
471
  border-color: var(--moses-gold) !important; color: var(--moses-gold) !important;