feat: show last benchmark time+accuracy on selected STT engine (v2.02.01)
After running a benchmark, each engine's best result (time, accuracy) is persisted to config and shown as a small info line in the Engines tab when that engine is selected. Updates live as the benchmark runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2df5be3212
commit
9b95c632fa
@ -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.
|
(not in a container) so it can type into any application via xdotool.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "2.02.00"
|
__version__ = "2.02.01"
|
||||||
|
|||||||
@ -124,6 +124,7 @@ class Config:
|
|||||||
bench_wav: str = ""
|
bench_wav: str = ""
|
||||||
bench_ref: str = ""
|
bench_ref: str = ""
|
||||||
bench_expand_models: bool = False
|
bench_expand_models: bool = False
|
||||||
|
bench_last: dict = field(default_factory=dict) # {engine_name: {seconds, accuracy, ok}}
|
||||||
# workflows
|
# workflows
|
||||||
workflows: list[Workflow] = field(default_factory=list)
|
workflows: list[Workflow] = field(default_factory=list)
|
||||||
|
|
||||||
@ -243,6 +244,7 @@ def load(path: Path = CONFIG_PATH) -> Config:
|
|||||||
bench_wav=data.get("benchmark", {}).get("wav", ""),
|
bench_wav=data.get("benchmark", {}).get("wav", ""),
|
||||||
bench_ref=data.get("benchmark", {}).get("ref", ""),
|
bench_ref=data.get("benchmark", {}).get("ref", ""),
|
||||||
bench_expand_models=bool(data.get("benchmark", {}).get("expand_models", False)),
|
bench_expand_models=bool(data.get("benchmark", {}).get("expand_models", False)),
|
||||||
|
bench_last=dict(data.get("benchmark", {}).get("last", {})),
|
||||||
)
|
)
|
||||||
|
|
||||||
for entry in data.get("workflow", []):
|
for entry in data.get("workflow", []):
|
||||||
@ -382,6 +384,7 @@ def save(cfg: Config, path: Path = CONFIG_PATH) -> None:
|
|||||||
"wav": cfg.bench_wav,
|
"wav": cfg.bench_wav,
|
||||||
"ref": cfg.bench_ref,
|
"ref": cfg.bench_ref,
|
||||||
"expand_models": cfg.bench_expand_models,
|
"expand_models": cfg.bench_expand_models,
|
||||||
|
"last": cfg.bench_last,
|
||||||
},
|
},
|
||||||
"wakeword_engine": [
|
"wakeword_engine": [
|
||||||
{"name": e.name, "uri": e.uri, "model": e.model} for e in cfg.wakeword_engines
|
{"name": e.name, "uri": e.uri, "model": e.model} for e in cfg.wakeword_engines
|
||||||
|
|||||||
@ -1210,6 +1210,12 @@ notebook.bt-nb tab:checked label {
|
|||||||
self.stt_result.set_valign(Gtk.Align.START)
|
self.stt_result.set_valign(Gtk.Align.START)
|
||||||
test_row.pack_start(self.stt_result, True, True, 0)
|
test_row.pack_start(self.stt_result, True, True, 0)
|
||||||
box.pack_start(test_row, False, False, 2)
|
box.pack_start(test_row, False, False, 2)
|
||||||
|
|
||||||
|
self.stt_bench_info = Gtk.Label(xalign=0.0)
|
||||||
|
self.stt_bench_info.set_use_markup(True)
|
||||||
|
self.stt_bench_info.set_margin_top(2)
|
||||||
|
box.pack_start(self.stt_bench_info, False, False, 0)
|
||||||
|
|
||||||
self._stt_load(self.stt_combo.get_active())
|
self._stt_load(self.stt_combo.get_active())
|
||||||
return box
|
return box
|
||||||
|
|
||||||
@ -1278,6 +1284,22 @@ notebook.bt-nb tab:checked label {
|
|||||||
else:
|
else:
|
||||||
_fill_combo(self.stt_model, [], e.model)
|
_fill_combo(self.stt_model, [], e.model)
|
||||||
self._stt_idx = idx
|
self._stt_idx = idx
|
||||||
|
self._stt_update_bench_info(e.name)
|
||||||
|
|
||||||
|
def _stt_update_bench_info(self, engine_name: str) -> None:
|
||||||
|
if not hasattr(self, "stt_bench_info"):
|
||||||
|
return
|
||||||
|
last = self.cfg.bench_last.get(engine_name)
|
||||||
|
if not last:
|
||||||
|
self.stt_bench_info.set_markup("")
|
||||||
|
return
|
||||||
|
if last.get("ok"):
|
||||||
|
self.stt_bench_info.set_markup(
|
||||||
|
f'<span foreground="#888" size="small">Last benchmark: '
|
||||||
|
f'<b>{last["seconds"]:.2f}s</b> · <b>{last["accuracy"]:.1f}%</b> accuracy</span>')
|
||||||
|
else:
|
||||||
|
self.stt_bench_info.set_markup(
|
||||||
|
'<span foreground="#888" size="small">Last benchmark: <b>failed</b></span>')
|
||||||
|
|
||||||
def _stt_commit(self) -> None:
|
def _stt_commit(self) -> None:
|
||||||
idx = self._stt_idx
|
idx = self._stt_idx
|
||||||
@ -2174,6 +2196,16 @@ notebook.bt-nb tab:checked label {
|
|||||||
lang_display = stt.fmt_languages(row.languages)
|
lang_display = stt.fmt_languages(row.languages)
|
||||||
self.bench_store.append([row.engine, url_display, row.model, row.device, row.best_for,
|
self.bench_store.append([row.engine, url_display, row.model, row.device, row.best_for,
|
||||||
lang_display, f"{row.seconds:.2f}", acc, out_friendly, tooltip])
|
lang_display, f"{row.seconds:.2f}", acc, out_friendly, tooltip])
|
||||||
|
# Persist result so Engines tab can show it
|
||||||
|
self.cfg.bench_last[row.engine] = {
|
||||||
|
"seconds": row.seconds, "accuracy": row.accuracy, "ok": row.ok,
|
||||||
|
}
|
||||||
|
save(self.cfg)
|
||||||
|
# Refresh info label if this engine is currently selected in Engines tab
|
||||||
|
if hasattr(self, "stt_name"):
|
||||||
|
cur = self.cfg.stt_engines[self._stt_idx].name if 0 <= self._stt_idx < len(self.cfg.stt_engines) else ""
|
||||||
|
if cur == row.engine:
|
||||||
|
self._stt_update_bench_info(row.engine)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _bench_done(self, rows) -> bool:
|
def _bench_done(self, rows) -> bool:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user