diff options
Diffstat (limited to 'AGENTS.md')
| -rw-r--r-- | AGENTS.md | 39 |
1 files changed, 28 insertions, 11 deletions
@@ -7,10 +7,10 @@ Guidance for AI coding agents working in this repository. `upscale-qt`: single-file PyQt6 desktop app (`upscale-qt`, no `.py` extension) to upscale an image with an ESRGAN model through `sd-cli` (stable-diffusion.cpp), compare before/after with a slider wipe, then save -as a new file or overwrite the original. A small vision model (imajev, run -one-shot through `llama-mtmd-cli`) suggests which upscaler to use. The only -Python dependency is PyQt6; everything else is stdlib plus the two external -binaries. Keep it a single file and do not add dependencies. +as a new file or overwrite the original. The model dropdown shows a +description per model from an optional `models.txt` in the upscalers +folder. The only Python dependency is PyQt6; everything else is stdlib plus +`sd-cli`. Keep it a single file and do not add dependencies. Design spec: `docs/superpowers/specs/2026-10-30-upscale-qt-design.md`. @@ -18,10 +18,12 @@ Design spec: `docs/superpowers/specs/2026-10-30-upscale-qt-design.md`. - Upscale: `sd-cli -M upscale --upscale-model <model> -i <in> -o <out.png>`. Models are `.pth`/`.safetensors`/`.gguf` files in the upscalers dir. -- Suggestion: `llama-mtmd-cli -m <imajev gguf> --mmproj <mmproj gguf> - --image <in> -p <prompt>`. Its answer is free text and gets matched to a - filename from the upscalers dir; never trust it as a path. -- Both run through `QProcess` so the UI never blocks. +- `sd-cli` runs through `QProcess` so the UI never blocks. +- sd-cli (stb_image) ignores EXIF orientation. `load()` applies it with + `QImageReader.setAutoTransform` and feeds sd-cli an upright temp PNG. +- `models.txt` lives with the models, not in the repo: `filename = what it + is for`, `#` comments. Model names stay out of the repo on purpose, the + personal-data hook flags at least one of them as a real name. - `sd-cli` loads ESRGAN (RRDBNet) and MoSR models only, detected from the weights. SwinIR, HAT, DAT, SPAN, Compact and face restorers do not load. - Model choice, measured on 4x crops of a clean portrait, a landscape and a @@ -32,8 +34,15 @@ Design spec: `docs/superpowers/specs/2026-10-30-upscale-qt-design.md`. blocks), 4xNomos8kSC (artifacts on noisy input), 4xLSDIRplusR (plastic on clean input), 4xLSDIRplusC (close to the foolhardy model, not better). - Timing: an RRDBNet model takes about 25 s per megapixel of input, so a - 10 MP photo takes about 4 minutes and outputs a 160 MP image. imajev - answers in about 7 s. + 10 MP photo takes about 4 minutes and outputs a 160 MP image. +- Model suggestion by a local vision model (imajev 4B via + `llama-mtmd-cli`) was built and removed. Measured on four photos it + picked the right model about half the time. It is a thinking model and + `llama-mtmd-cli` has no switch to turn thinking off (no + `--chat-template-kwargs`, `/no_think` ignored); with `--temp 0` it loops + on `</think> <answer>` until `-n`, without `--jinja` it emits an empty + answer. Do not bring it back without a better model or a server that + can disable thinking. ## Conventions @@ -46,7 +55,15 @@ Design spec: `docs/superpowers/specs/2026-10-30-upscale-qt-design.md`. ## Testing -No test suite yet. + python3 test_upscale_qt.py + +Plain asserts for the helpers plus offscreen smoke tests of `CompareView` +and `Main`. The test sets `XDG_CONFIG_HOME` to a temp dir, so it never +touches the real settings. For an end-to-end check with the real +`sd-cli`, load the script with `SourceFileLoader` under +`QT_QPA_PLATFORM=offscreen`, call `load()` and `upscale()`, wait on +`proc.finished` with a `QEventLoop`, and `grab()` a screenshot. Use a small +image: about 25 s per input megapixel. ## Repo facts |
