diff options
Diffstat (limited to 'imggen')
| -rw-r--r-- | imggen | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright (C) 2026 Danilo +# Licensed under the GNU General Public License version 2. +# +# Host-side wrapper for local SDXL image generation on Intel Arc. +# Handles GPU passthrough, the /out bind-mount (so output lands on the host, +# never trapped inside the container), and a persistent model cache (so the +# ~7.5GB of weights download once, not every run). +# +# Usage: +# imggen "a red bicycle against a stone wall" +# imggen "a foggy harbour at dawn" --steps 30 --seed 42 +# imggen "portrait of a fox" -o fox.png -n "blurry, low quality" +# +# All arguments are passed straight through to generate.py. + +set -euo pipefail + +IMAGE="imggen:local" + +# Where generated images land on the host. Override with IMGGEN_OUT. +OUT_DIR="${IMGGEN_OUT:-$HOME/imggen-out}" + +# Persistent model cache on the host. Override with IMGGEN_CACHE. +CACHE_DIR="${IMGGEN_CACHE:-$HOME/.cache/imggen-models}" + +mkdir -p "$OUT_DIR" "$CACHE_DIR" + +if [ "$#" -eq 0 ]; then + echo "usage: imggen \"<prompt>\" [--steps N] [--guidance G] [--seed S] [-n \"<negative>\"] [-o name.png]" >&2 + exit 1 +fi + +exec docker run --rm -it \ + --device /dev/dri \ + -v "$OUT_DIR:/out" \ + -v "$CACHE_DIR:/models" \ + "$IMAGE" "$@" |
