How it fits together
Two volumes hold the weights and the finished images, a map holds one
progress record per running job, and the
IMAGE_STUDIO_KEY secret is the
studio key. Idle, the system pays for storage only, about 16 GB of weights
plus the last seven days of images.
Run it
1
Download
The CLI installs once with PyTorch and diffusers sit in the
uv tool install lazycloud-client. The commands
below download a standalone project and install its dependencies; no
repository checkout is needed. The guide then runs from that directory through
uv run, which uses the project’s pinned SDK.gpu dependency group, which only the
remote image installs.2
Configure
The script asks for a studio key, stores it as a secret and runs
download_weights.3
Deploy
studio URL. The
first deploy builds three images.4
Use
Open the URL, enter the key, and generate. Each requested image gets a
tile in the gallery that shows why the job waits, then each step. Select an
image to download it, copy a share link or reuse its settings. The API
also works without the page:
uv run lazycloud task list --app image_studio lists the generation
tasks, and uv run lazycloud task logs <job-id> prints one’s output.A GPU function that loads once
A function runson_start before its container takes
a call, so the pipeline loads once, and keep_warm=300 holds it for five
minutes between prompts.
image_studio/generate.py
Spawn and the task queue
.spawn() returns a task ID at once, the queue
holds up to 16 waiting jobs, and a refused job becomes a 503.
image_studio/web.py
A map for progress
A map carries one small record per job from the GPU to the WebSocket, and the task view fills in what the function cannot report, such as waiting for a machine.image_studio/web.py
Volumes for weights
A volume outlives any container, so the weights download once and every GPU container reads them from the mount; the marker file goes last so no container loads a partial download.image_studio/weights.py
A nightly schedule
A schedule is a function withcron; this one runs on
a quarter CPU and keeps the gallery to seven days.
image_studio/cleanup.py
Adapt it
- Another diffusers model needs its repository, revision and file patterns in
weights.py, the pipeline class ingenerate.py, and a GPU with enough memory. - Styles and shapes live in
generation.py; the page reads them from/api/options, so it needs no change. - More throughput comes from
autoscaler=Autoscaler(max_containers=...)ongenerate_images, since each job is independent.
Clean up
uv run lazycloud artifact list and uv run lazycloud artifact delete <artifact-id>
remove them sooner.