No description
  • HTML 63.3%
  • Python 35.7%
  • PowerShell 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-09 01:53:24 +02:00
docs Stop tracking local model files 2026-09-09 01:53:24 +02:00
Local-Gallery 1-41 2026-09-09 01:41:09 +02:00
tests 1-41 2026-09-09 01:41:09 +02:00
.gitignore Stop tracking local model files 2026-09-09 01:53:24 +02:00
download_ip_adapter.py 11:32 2026-08-31 11:32:26 +02:00
log_utils.py 11:32 2026-08-31 11:32:26 +02:00
models.py v2.0 2026-08-29 03:12:21 +02:00
README.md Stop tracking local model files 2026-09-09 01:53:24 +02:00
requirements.txt 11:32 2026-08-31 11:32:26 +02:00
run_all_model.py v1.0: centralize model registry and runner 2026-08-29 02:20:26 +02:00
runner.py 11:32 2026-08-31 11:32:26 +02:00
setup_windows.ps1 11:35 2026-08-31 11:33:12 +02:00

Local Image Studio

A local Windows image-generation workspace with five local text-to-image checkpoints, a browser gallery, prompt controls, queue management, and local image saving.

Components

  • models/: all local text-to-image model files
  • models.py: single registry for model ids, labels, paths, checkpoints, scheduler overrides, and defaults
  • runner.py: shared generation runner for every model, including optional IP-Adapter-FaceID character reference conditioning
  • download_ip_adapter.py: one-time download of the SDXL IP-Adapter-FaceID weights used by the Characters feature
  • log_utils.py: shared rotating file logging for runner.py and Local-Gallery/server.py (logs/runner.log, logs/gallery.log)
  • Local-Gallery/: local browser UI and Python server, including Characters and Story sections for consistent-character panel sequences
  • run_all_model.py: runs all installed models sequentially
  • pics/: generated images and batch folders
  • requirements.txt: Python dependencies for the runners and gallery
  • setup_windows.ps1: creates the local virtual environment and installs dependencies
  • docs/: project documentation (setup, sources, prompt reference, improvement plan, changelog)

Model weights and all model-support files under models/ are local-only and excluded from Git. Copy them separately when moving the workspace to another machine.

Setup On Another Windows PC

Install Python 3.10 or newer, clone or copy the repository, then run PowerShell from the repository folder:

Set-ExecutionPolicy -Scope Process Bypass
.\setup_windows.ps1

The setup script creates the root .venv and installs requirements.txt. It does not download model weights; copy the local models/ folder separately after cloning the repository.

For the complete first-run and everyday startup steps, see docs/HOW_TO_START.md.

Run Local-Gallery/start_gallery.cmd, then open:

http://127.0.0.1:8765

The page supports prompt editing, negative prompts, prompt presets, an ethnicity option, multiple pose lines, generation settings (including GPU Protection mode with VRAM capping, maximum native rendering size, inter-job cooldowns, VAE tiling, attention slicing, and CPU offload), a model-grouped queue, stop controls, a grouped gallery, metadata viewing, deletion, downloading, image zoom, a live statistics dashboard at /statistics, a live generation monitor at /monitor, and a clean hidden raw gallery view at /gallery (or /gallery.html) with thumbnail size controls and model filtering. Consecutive jobs using the same model reuse one persistent runner and its loaded pipeline.

Story batches are shown in the gallery as one ordered five-column panel strip instead of one row per panel folder.

Prompt/settings form state is saved on the server (Local-Gallery/form_state.json) and loaded on page open, so the last-used prompt is shared across every device on the network, not just the browser that typed it.

Characters And Story Mode

The Characters section lets you save a reusable identity: a name, a fixed appearance description, an optional negative-prompt extra, a preferred model, a locked seed, and a reference image. Reference images are conditioned in with SDXL IP-Adapter-FaceID, which extracts an actual face embedding from the image (via insightface) rather than just a generic style match, so the same face carries across generations; run download_ip_adapter.py once, with internet access, before using this (see docs/SOURCES.md). Click "Use as character" on any gallery image to pre-fill a new character from that image's saved prompt, seed, model, steps, guidance, and resolution, using the image itself as the reference.

The Story section sequences panels, each referencing one or more characters plus a scene description. "Generate story" queues one job per panel, reusing each character's locked seed, reference image, and remembered generation recipe (steps/guidance/resolution), and saves the panels together under pics/<timestamp>-story-<title>/panelNN/<model>/.

Monitoring And Time Estimates

/monitor shows the live queue (active model, shot/step progress, per-job and total queue ETA) next to a forecast panel that predicts total generation time for a model/size/steps/shots/guidance combination before queueing it, along with the completed runs the forecast is based on and a confidence label.

ETAs come from Local-Gallery/generation_metrics.json. A run is only treated as comparable when its full generation profile matches: model, generation size, steps, guidance, Native QHD, VAE tiling, attention slicing, CPU offload, and whether a character reference image was used. The estimate is the median of the last five matching runs, so a single slow outlier no longer inflates every later estimate. When no exact match exists, recent runs for the same model are scaled by megapixels and steps. Older records that predate the profile fields still work through a legacy fallback.

The statistics dashboard reports "Image files on disk" from an actual count of PNG files under pics/, separately from the run history totals, which only cover runs recorded by this server.

Logging

runner.py and Local-Gallery/server.py write rotating logs to logs/runner.log and logs/gallery.log (5 MB x 3 backups each), independent of the gallery's live status message. Check these files when a generation appears to start and then stop with no visible error.

Resolution Behavior

The gallery accepts these output sizes: 768x1024, 1536x2048, 1024x768, 2048x1536, 1920x1080, 2560x1440, 3840x2160, 768x768, and 1536x1536. Any other size is reset to 768x1024 by the gallery server. The Landscape Native QHD preset renders 2560x1440 directly rather than resizing it.

The shared runner uses the same resolution policy for every model: it preserves the requested aspect ratio, generates at a size whose longest side is at most 1024 pixels, rounds each generated dimension to a multiple of 8, and saves a Lanczos-resized image at the requested output size. Requests at or below that limit are generated at their requested dimensions.

For example, 1536x2048 generates at 768x1024, 2048x1536 generates at 1024x768, and 3840x2160 generates at 1024x576; each is then resized to the requested size. The Native QHD preset is the exception: it enforces 2560x1440 diffusion with GPU protection, a 12 GB VRAM cap, VAE tiling, attention slicing, CPU offload, and a five-second cooldown. It was verified on the local RTX 3060. The other larger output files are conventional resizes, not a second AI upscaling pass or native high-resolution diffusion generation.

Pending queue jobs are saved in Local-Gallery/queue.json and restored when the server starts. The file contains the selected model and its prompt/settings; generated images are saved in pics/.

Run All Models From PowerShell

cd "F:\ai2\Új mappa"
& ".\.venv\Scripts\python.exe" ".\run_all_model.py"

The five models run one at a time. Combined runs are saved under:

pics/YYYY-MM-DD-HH-MM-SS-all-models/<model>/

Run One Model From PowerShell

The shared runner accepts a registered model id directly:

& ".\.venv\Scripts\python.exe" ".\runner.py" --model lustify --prompt "your prompt here"

The available ids are original, realvis, lustify, nsfwgen, and pornworks. The gallery and run_all_model.py use the same registry, so adding a model requires one entry in models.py.

For integrations, runner.py --model <id> --serve accepts one JSON job per stdin line with prompt, settings, and optional batch_dir; it emits JSON-line progress and error events on stdout.

The server listens on all network interfaces. From another device on the same network, open:

http://<this-pc-lan-ip>:8765

If Windows Firewall blocks it, run as Administrator on the host PC:

New-NetFirewallRule -DisplayName "Local Image Studio" -Direction Inbound -Protocol TCP -LocalPort 8765 -Action Allow -Profile Private

API Documentation

Open http://<ip>:8765/api for an interactive Swagger UI describing every endpoint (/api/run, /api/stop, /api/status, /api/gallery, /api/queue/remove, /api/delete-image, /api/delete-folder, /api/form-state). The raw spec is at /api/openapi.json. The Swagger UI page itself loads its assets from a CDN, so viewing /api requires internet access; the API and its data stay local.

Current Local Status

  • One gallery server runs on 127.0.0.1:8765 and is reachable on the LAN.
  • Port 8766 is unused.
  • New output folders use YYYY-MM-DD-HH-MM-<model>.
  • All-model folders use YYYY-MM-DD-HH-MM-SS-all-models/<model>/.
  • The gallery groups images by the main batch folder and supports zoom, download, settings, and deletion.

Git Contents

The backup branch contains the pre-zoom UI snapshot, while master contains the current code. Model weights, generated images, configurations, and runtime metadata are uploadable. Only recreatable local files such as caches, Python bytecode, and the virtual environment are ignored.