Feat/usability overhaul#6
Merged
Merged
Conversation
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
…uard; README python note
nathanchenseanwalter
added a commit
that referenced
this pull request
Jul 8, 2026
Feat/usability overhaul
nathanchenseanwalter
added a commit
that referenced
this pull request
Jul 8, 2026
Feat/usability overhaul
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.