Skip to content

Feat/usability overhaul#6

Merged
nathanchenseanwalter merged 9 commits into
mainfrom
feat/usability-overhaul
Jul 5, 2026
Merged

Feat/usability overhaul#6
nathanchenseanwalter merged 9 commits into
mainfrom
feat/usability-overhaul

Conversation

@nathanchenseanwalter

Copy link
Copy Markdown
Contributor

No description provided.

Nathaniel Chen added 9 commits July 4, 2026 18:40
…les)

Carve reusable, gradio-free logic out of the app so a later CLI task and
the app can share it: compute_stft (transforms.py), model_infer/warmup/
signal_to_spectrogram (inference.py), HF Hub + local model resolution
(hub.py), and a deterministic synthetic demo signal (examples.py).
src/tokeye/app/ is untouched; a later task rewires it to delegate here.

Adds huggingface-hub and tqdm as core dependencies.
…ules

- analyze.py: default-populated transform_args (kills the silent-None trap
  where nothing works until Setup Transform is clicked), registry-aware
  model dropdown with automatic HF download + cache-aware toast, one-click
  "Analyze" button (ensure_model -> infer -> visualize), "Load Example
  Signal" button backed by tokeye.examples, friendlier copy.
- load.py: delegates model loading/warmup to tokeye.hub/tokeye.inference,
  compute_stft to tokeye.transforms; deletes the now-redundant torch.load
  branching and inline warmup loop.
- visualize.py: enhance() copies its input before mutating it in place, so
  repeated Visualize clicks no longer corrupt the stored inference output.
- __main__.py: extracts main(port, share, open_browser), replaces ad-hoc
  sys.argv parsing with argparse, loads the logo via importlib.resources
  (guarded, no crash if missing) now that it's packaged under
  src/tokeye/app/assets/.
- Deletes dead modules superseded by the Task 1 core package: app/analyze
  /transforms.py, app/processing/, app/utils/analyze.py, tokeye/analysis/
  (all already had stale TokEye.* import paths from before the package
  rename).
- Adds tests/test_app_load.py covering model_load delegation, find_models,
  load_single 1D/2D handling, the new is_model_cached helper, and a
  create_app() smoke-construction test.
gr.Warning does not halt a gradio .then() chain, so the previous
warn-first step still let ensure_model trigger a real model download
plus warmup on a no-signal click. ensure_model now takes
signal_transform and short-circuits (warn + return model state
unchanged) when it is None; downstream model_infer/show_image already
no-op on None. Adds three ensure_model tests covering skip/passthrough/
cold-load paths, and removes the now-unused SIGNAL_DIR constant from
app/analyze/load.py.
Adds tokeye.batch (gradio-free, Agg-backend batch runner: collect_inputs,
load_input, save_overlay_png, process_file, run_batch) and tokeye.cli
(argparse entry point with app/run/download/example subcommands, heavy
imports deferred into handlers so `tokeye --help` is instant and `tokeye
run` never touches gradio). Wires up the `tokeye` console script.
- tokeye example: normalize extension-less --output to .npy before saving
  so the printed path is the file np.save actually writes
- tokeye run: catch FileNotFoundError from a mistyped --model path and
  emit a clean stderr error (exit 2) instead of a raw traceback
- test_loads_model_once_via_hub: use two input files so once-per-run is
  distinguishable from once-per-file
@nathanchenseanwalter nathanchenseanwalter merged commit 93f59be into main Jul 5, 2026
3 checks passed
@nathanchenseanwalter nathanchenseanwalter deleted the feat/usability-overhaul branch July 5, 2026 00:09
nathanchenseanwalter added a commit that referenced this pull request Jul 8, 2026
nathanchenseanwalter added a commit that referenced this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant