Skip to main content
A web page takes a prompt and returns up to four images from FLUX.2 [klein] 4B, showing each denoising step as it runs. Images stay in a gallery for seven days, and any of them can become a public link. You get one URL to open, a studio key to type once, and a system that runs nothing between jobs except a nightly cleanup.

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 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.
PyTorch and diffusers sit in the 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

One deploy covers all five workloads and prints the 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 runs on_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 with cron; this one runs on a quarter CPU and keeps the gallery to seven days.
image_studio/cleanup.py
Share links come from artifacts with a public URL, capped by your plan’s retention.

Adapt it

  • Another diffusers model needs its repository, revision and file patterns in weights.py, the pipeline class in generate.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=...) on generate_images, since each job is independent.

Clean up

Shared links stop working when their artifacts expire. uv run lazycloud artifact list and uv run lazycloud artifact delete <artifact-id> remove them sooner.