diff --git a/linux/blitztext/__init__.py b/linux/blitztext/__init__.py index 3f78482..e11926c 100644 --- a/linux/blitztext/__init__.py +++ b/linux/blitztext/__init__.py @@ -6,4 +6,4 @@ counterpart to the macOS Blitztext menu bar app: it runs natively on the host (not in a container) so it can type into any application via xdotool. """ -__version__ = "2.0.3" +__version__ = "2.0.4" diff --git a/linux/blitztext/benchmark.py b/linux/blitztext/benchmark.py index b003f36..131c4ea 100644 --- a/linux/blitztext/benchmark.py +++ b/linux/blitztext/benchmark.py @@ -19,7 +19,8 @@ from .routing import normalize class BenchRow: engine: str model: str - device: str # "CPU" | "GPU" | "remote" + device: str # "CPU" | "CUDA" | "remote" + best_for: str # "Short clips" | "Short / medium" | "Long / batch" | "Streaming" ok: bool seconds: float wer: float @@ -60,10 +61,29 @@ def wer(reference: str, hypothesis: str, *, case_sensitive: bool = False) -> flo def _engine_device(engine, transcriber) -> str: if engine.is_local: - return "GPU" if getattr(transcriber, "device", "cpu") == "cuda" else "CPU" + return "CUDA" if getattr(transcriber, "device", "cpu") == "cuda" else "CPU" return "remote" +def _engine_best_for(engine) -> str: + if engine.type == "riva_realtime": + return "Streaming" + model = (engine.model or "").lower() + name = engine.name.lower() + if any(x in name for x in ("stream", "realtime", "real-time", "live")): + return "Streaming" + if engine.is_local: + if any(x in model for x in ("tiny", "base")): + return "Short clips" + if any(x in model for x in ("large",)): + return "Long / batch" + return "Short / medium" + # Remote endpoint + if any(x in name for x in ("large", "batch")): + return "Long / batch" + return "Short / medium" + + def run(engines, wav_path: Path, reference: str, *, language: str = "", case_sensitive: bool = True, get_local_transcriber=None, progress=None) -> list[BenchRow]: """Benchmark each engine; calls progress(row) as each finishes. @@ -79,6 +99,7 @@ def run(engines, wav_path: Path, reference: str, *, language: str = "", engine=e.name, model=e.model or ("local" if e.is_local else "(default)"), device=_engine_device(e, tr), + best_for=_engine_best_for(e), ok=res.ok, seconds=res.seconds, wer=w, diff --git a/linux/blitztext/gtksettings.py b/linux/blitztext/gtksettings.py index 6dbe088..b21143b 100644 --- a/linux/blitztext/gtksettings.py +++ b/linux/blitztext/gtksettings.py @@ -1857,12 +1857,13 @@ notebook.bt-nb tab:checked label { run.set_halign(Gtk.Align.START) page.pack_start(run, False, False, 6) - self.bench_store = Gtk.ListStore(str, str, str, str, str, str) + self.bench_store = Gtk.ListStore(str, str, str, str, str, str, str) tree = Gtk.TreeView(model=self.bench_store) for title, i, expand in [("Engine", 0, False), ("Model", 1, False), ("Device", 2, False), - ("Time (s)", 3, False), ("Accuracy", 4, False), ("Output", 5, True)]: + ("Best for", 3, False), ("Time (s)", 4, False), + ("Accuracy", 5, False), ("Output", 6, True)]: r = Gtk.CellRendererText() - if i == 5: + if i == 6: r.set_property("ellipsize", Pango.EllipsizeMode.END) col = Gtk.TreeViewColumn(title, r, text=i); col.set_resizable(True) col.set_expand(expand) @@ -1951,7 +1952,8 @@ notebook.bt-nb tab:checked label { def _bench_add_row(self, row) -> bool: acc = f"{row.accuracy:.1f}%" if row.ok else "—" out = row.text if row.ok else f"⚠ {row.error}" - self.bench_store.append([row.engine, row.model, row.device, f"{row.seconds:.2f}", acc, out]) + self.bench_store.append([row.engine, row.model, row.device, row.best_for, + f"{row.seconds:.2f}", acc, out]) return False def _bench_done(self, rows) -> bool: