"""Run the interface locally with the models stubbed out, for laying out the UI. No GPU, no weights, no downloads. The fake zoom just bicubic-enlarges, so the pictures are meant to be blurry: this is for arranging the page, not for judging output. uv run --no-project --python 3.12 --with "gradio==5.50.0" --with spaces --with pillow \ --with numpy --with imageio --with imageio-ffmpeg python space/dev_ui.py """ import os import sys import types from PIL import Image HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) os.chdir(HERE) import geometry # noqa: E402 (after the path insert, on purpose) FAKE_PROMPTS = [ "spotted fur, whiskers, amber eye, fine hairs", "dense guard hairs, rosette edge, warm tones", "single hair shafts, follicle, soft focus", "fine keratin fibre, grain, pale strands", "fibre bundle, faint striations", "surface texture, low contrast", "granular detail, muted", "flat texture, little structure", ] def fake_zoom(models, image, levels=4, upscale=4, center=(0.5, 0.5)): cur = geometry.resize_and_center_crop(image) yield 0, 1, "", cur, cur for i in range(levels): blurry = geometry.zoom_window(cur, upscale, center).resize(cur.size, Image.BICUBIC) yield i + 1, upscale ** (i + 1), FAKE_PROMPTS[i % len(FAKE_PROMPTS)], blurry, blurry cur = blurry stub = types.ModuleType("zoom") stub.Models = type("Models", (), {"__init__": lambda self, weights=None: None}) stub.zoom = fake_zoom sys.modules["zoom"] = stub import app # noqa: E402 (must follow the stub) BANNER = ( '