Local AI · DGX Spark
AI Image Studio
Type one plain sentence, get one professional image.
LLM prompt refinement × multi-model ComfyUI — all on our own GPU.
The live interface — captured with Playwright
Why build one
Cloud image generators are great, except for three things: your data leaves the building, you pay per image, and you don't choose the model. For internal enterprise use, the first one is a deal-breaker — slide assets and product mockups often carry unreleased information.
There was an idle GPU on the DGX Spark at home. Stand up ComfyUI, wire a large language model in front of it as a translator, and you get an image studio that is free, private, and model-agnostic.
The real challenge is the layer in between: colleagues who can't write an English prompt still need to get great results.
How it works: the journey of one image
From one Chinese sentence to a 1536×1024 render — five things happen in between.
A plain-language description arrives
Users describe the picture in natural Chinese. SD-family models can't read Chinese — feed it directly and you get garbled fake glyphs and uncanny portraits, so the request is intercepted first.
An LLM acts as translator + prompt engineer
A language model behind the local LLM gateway rewrites the input into a professional English prompt — adding lighting, composition and camera language, and blending in the user's chosen inspiration tags. This step is what makes "anyone can produce good images" true — one rewrite takes about 6–8 seconds.
ComfyUI workflow assembly
A FastAPI wrapper builds the node graph on the fly: loads the selected checkpoint (Dreamshaper / Illustrious / RealVisXL / FLUX.1 schnell), sets sampler and steps (14 / 22 / 32 for fast / standard / fine). The seed is a hash of the prompt — the same description always reproduces the same image.
Two-pass hires upscaling
SD1.5 breaks composition when rendering large images directly (duplicate heads, extra limbs). The fix: render at a safe resolution first, then LatentUpscaleBy 1.5× / 2× with a second low-strength sampling pass (denoise 0.55) to restore detail — 2× to 1536×1024 takes about 14 seconds.
Same-origin proxy returns the image
The render comes back as base64 through a Spring Boot same-origin proxy — the browser never talks to the GPU host directly (no mixed content), and access control (allowlist / Basic Auth) is enforced in one place. Image-to-image takes the same path: reference images are compressed to 1280px in the browser before upload.
Deep dive: the ComfyUI node graph
Two independent AI pipelines power the tool: a language model rewrites the description into instructions the image model understands, and a ComfyUI diffusion graph turns text into pixels step by step. Below is the actual txt2img node flow (kept in sync with the tool's built-in principle page).
The tool's built-in principle page — real ComfyUI node graph with live model status
img2img variant
LoadImage → ImageScaleToTotalPixels (follows reference aspect) → VAEEncode → KSampler (denoise = variation slider 25–90%) → VAEDecode → SaveImage
4
switchable models (incl. FLUX)
~14s
2× hires to 1536×1024
12
one-click style presets
0
times data left the network
Key design decisions
LLM refinement instead of prompt training
Rather than teaching the whole company prompt engineering, let the local model do it. The input bar drops to "can type plain language", while the quality floor rises dramatically.
SD1.5 as default, FLUX as the quality option
The GPU also serves a 35B chat model, so the image model must coexist without fighting for memory. Lightweight SD1.5 handles daily work; FLUX schnell covers high-stakes renders — a pragmatic resource trade-off.
seed = hash(prompt): reproducibility first
The same description always yields the same image — iterate by editing words and comparing diffs, never fighting randomness. Turning noise into a controlled variable.
The tool documents itself
Below the workspace, the tool renders its real ComfyUI node graph (wires drawn as bezier curves from live DOM positions) with live model status — the tool is its own living architecture doc.
Architecture
Frontend
Single-file HTML studio
txt2img / img2img
denoise, size, quality dials
Proxy
Spring Boot same-origin proxy
allowlist / Basic Auth
forced HTTP/1.1
Inference
ComfyUI on DGX Spark
SD1.5 × 3 + FLUX.1 schnell
FastAPI workflow wrapper
LLM
Local model via LiteLLM gateway
Chinese → pro English prompt
inspiration-tag fusion
The live tool is locked behind Basic Auth — this page shares the architecture and design.