From 69810152d0dfedeaa02a96df73cbc184225a1278 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 30 Oct 2026 19:15:03 +0100 Subject: Drop imajev suggestion, describe models from models.txt The vision model picked the right upscaler about half the time on four test photos, and llama-mtmd-cli cannot turn its thinking off: greedy decoding loops, larger budgets cost seconds and still miss. The dropdown now shows a one-line description per model from an optional models.txt next to the models, so the choice stays with the user but is readable. Document usage, model descriptions and how to test. Co-Authored-By: Claude Opus 5.5 --- test_upscale_qt.py | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'test_upscale_qt.py') diff --git a/test_upscale_qt.py b/test_upscale_qt.py index 1fbfe2c..cb11346 100644 --- a/test_upscale_qt.py +++ b/test_upscale_qt.py @@ -30,20 +30,6 @@ _loader.exec_module(uq) from PyQt6.QtGui import QColor, QImage, QImageReader # noqa: E402 -NAMES = ['4x_detail.pth', 'RealESRGAN_x4plus.pth', - 'RealESRGAN_x4plus_anime_6B.pth'] - - -def test_match_model(): - m = uq.match_model - # the longer stem must win over its own prefix - assert m('RealESRGAN_x4plus_anime_6B.pth', NAMES) == 'RealESRGAN_x4plus_anime_6B.pth' - assert m(' realesrgan_x4plus\n', NAMES) == 'RealESRGAN_x4plus.pth' - assert m('I suggest 4x_detail.', NAMES) == '4x_detail.pth' - assert m('no idea', NAMES) is None - assert m('', []) is None - - def test_list_models(): d = os.path.join(TMP, 'models') os.makedirs(d) @@ -53,15 +39,25 @@ def test_list_models(): assert uq.list_models(os.path.join(TMP, 'missing')) == [] +def test_descriptions(): + d = os.path.join(TMP, 'models') + with open(os.path.join(d, 'models.txt'), 'w') as f: + f.write('# comment = ignored\n' + 'a.pth = Clean photos: people, nature\n' + '\n' + 'no separator here\n' + ' c.GGUF=Anime \n') + desc = uq.read_descriptions(d) + assert desc == {'a.pth': 'Clean photos: people, nature', 'c.GGUF': 'Anime'} + assert uq.model_label('a.pth', desc) == 'Clean photos: people, nature [a]' + assert uq.model_label('b.safetensors', desc) == 'b.safetensors' + assert uq.read_descriptions(os.path.join(TMP, 'missing')) == {} + + def test_args(): a = uq.sd_args('/m/x.pth', '/in.png', '/out.png') assert a == ['-M', 'upscale', '--upscale-model', '/m/x.pth', '-i', '/in.png', '-o', '/out.png'] - a = uq.llama_args('/m.gguf', '/mm.gguf', '/in.png', NAMES) - assert a[a.index('--image') + 1] == '/in.png' - prompt = a[a.index('-p') + 1] - assert all(n in prompt for n in NAMES) - assert 'noise' in prompt def test_save_over(): @@ -98,7 +94,6 @@ def test_compare_view(): def test_main_window(): w = uq.Main() - w.cfg.setValue('imajev_model', '') # never run the real VLM in tests w.cfg.setValue('upscalers_dir', os.path.join(TMP, 'models')) w.reload_models() assert not w.a_up.isEnabled() # no image yet @@ -110,6 +105,8 @@ def test_main_window(): assert len(w.jobs) == 1 and w.jobs[0].image.size() == img.size() assert os.path.exists(w.jobs[0].input) assert w.a_up.isEnabled() and not w.a_save.isEnabled() + assert w.models.itemText(0) == 'Clean photos: people, nature [a]' + assert w.models.currentData() == 'a.pth' if __name__ == '__main__': -- cgit v1.2.3