Skip to content

Commit d5f47aa

Browse files
authored
Update browser.py
1 parent 3d4d59b commit d5f47aa

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

modules/browser.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
import json
1010
import os
1111

12+
try:
13+
from benchmarks import get_all_benchmarks
14+
except ImportError:
15+
def get_all_benchmarks(): return {}
16+
1217

1318
# ── Load model catalog ────────────────────────────────────────────────────────
1419

@@ -149,7 +154,7 @@ def draw_footer(stdscr, height, width):
149154
stdscr.attroff(curses.color_pair(1))
150155

151156

152-
def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width):
157+
def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width, benchmarks=None):
153158
"""Draw the scrollable model list."""
154159
visible = models[scroll_offset: scroll_offset + list_height]
155160

@@ -179,8 +184,14 @@ def draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_heig
179184
label = COMPAT_LABELS.get(compat, "")
180185
v_tag = " ✓" if verified else " ?"
181186

187+
# Benchmark score for this variant
188+
bench_filename = model.get("_best_variant", {}).get("filename", "")
189+
bench_data = (benchmarks or {}).get(bench_filename, {})
190+
tps = bench_data.get("gen_tps", 0)
191+
bench_str = f" ⚡{int(tps)}t/s" if tps > 0 else ""
192+
182193
# Build the line
183-
line_left = f" {icon} {name} ({params}){v_tag}"
194+
line_left = f" {icon} {name} ({params}){v_tag}{bench_str}"
184195
line_right = f"{variant} {size_dl}GB↓ {size_ram}GB RAM {label} "
185196
padding = width - len(line_left) - len(line_right)
186197
if padding < 1:
@@ -256,6 +267,7 @@ def run_browser(stdscr, models, device_profile):
256267

257268
selected = 0
258269
scroll_offset = 0
270+
benchmarks = get_all_benchmarks()
259271

260272
while True:
261273
stdscr.clear()
@@ -284,7 +296,7 @@ def run_browser(stdscr, models, device_profile):
284296
scroll_offset = selected - list_height + 1
285297

286298
draw_header(stdscr, device_profile, width)
287-
draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width)
299+
draw_model_list(stdscr, models, selected, scroll_offset, list_top, list_height, width, benchmarks)
288300

289301
current_model = models[selected] if models else None
290302
draw_detail_panel(stdscr, current_model, detail_top, width)

0 commit comments

Comments
 (0)