#!/usr/bin/env python3
import sys, json
sys.path.insert(0, "/root/notchlight/tools")
from falgen import run, download, req

BG_PROMPT = """Flat storybook cartoon illustration, vertical 9:19.5 poster, hand-painted gouache on cold-press paper with visible grain and slightly uneven ink outlines.

A quiet attic bedroom at night, seen straight on, empty of people. Deep indigo and dusty teal shadows, warm cream and amber accents, muted rust. Bottom center: a small round wooden stool on a worn rug. Around it: a stack of picture books, a sleeping ginger cat curled into a crescent, a tipped-over mug, a paper garland of little stars. Upper right: a round attic window with a thin crescent moon and a scatter of stars, cool moonlight falling in a soft diagonal. Upper left: a low shelf with a jar of fireflies, a folded quilt, a toy boat. The top third of the image is calm, dark and uncluttered — a large empty indigo area with only a few faint stars and dust, leaving room for a clock. Simple flat shapes, thick soft dark-brown outlines, gentle texture, no gradients that look digital, no text, no lettering, no people, no animals except the sleeping cat. Whimsical, cozy, cinematic, children's picture book."""

out = run("blackforestlabs/flux-3/klein/text-to-image", {
    "prompt": BG_PROMPT,
    "image_size": {"width": 1206, "height": 2622},
    "num_images": 1,
    "output_format": "png",
    "enable_prompt_expansion": True,
    "enable_safety_checker": False,
    "seed": 4242,
}, label="bg")

print(json.dumps(out, indent=1)[:1200])
for i, img in enumerate(out.get("images", [])):
    download(img["url"], f"/root/notchlight/assets/bg_v1.png")
    print("saved", img["url"][:100])
