diff options
| author | tslil <tslil@posteo.de> | 2026-07-23 13:56:44 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-07-23 14:17:54 +0100 |
| commit | e15d034059723b0b1504da6e6a5daa47f11f2b2d (patch) | |
| tree | 917039e7fb5d5d47ece29a4429d2e1f4dc496ffa /wallpaper.py | |
| parent | 4ed8e0f7febe2e3744e47badabe2d907e7cc6d20 (diff) | |
wallpaper.py: add biomes, fix camera angles
Diffstat (limited to 'wallpaper.py')
| -rwxr-xr-x | wallpaper.py | 89 |
1 files changed, 64 insertions, 25 deletions
diff --git a/wallpaper.py b/wallpaper.py index 6948403..9cd0c2f 100755 --- a/wallpaper.py +++ b/wallpaper.py @@ -141,6 +141,8 @@ def step_llm( system_prompt: str, max_tokens: int, taste_prompts: list[str], + taste_sample_frac: float, + biomes: list[str], perspectives: list[str], temperature: float, top_p: float, @@ -158,14 +160,20 @@ def step_llm( verbose=False, ) - taste_prompts = list(taste_prompts) - random.shuffle(taste_prompts) + # random.sample also shuffles, so ordering varies run to run + total = len(taste_prompts) + k = max(1, round(taste_sample_frac * total)) + taste_prompts = random.sample(list(taste_prompts), k) taste_prompt_str = ", ".join(taste_prompts) + logger.info(f"Taste ({k}/{total} sampled): {taste_prompt_str}") + biome = random.choice(biomes) + logger.info(f"Biome: {biome}") perspective = random.choice(perspectives) logger.info(f"Perspective: {perspective}") prompt = ( f"Taste reference: {taste_prompt_str}. " + f"Required biome: {biome}. " f"Required perspective: {perspective}. " f"Context: {ctx}. " f"Reply with one text-to-image prompt only." @@ -368,34 +376,58 @@ def parse_args() -> argparse.Namespace: "--taste-prompt", nargs="+", default=[ - "natural scenes", - "serene", - "trees", - "plants", - "landscape", - "brutalist pristine concrete", - "hypermodern flawless concrete architecture", - "moss", - "rocks", - "abstract concrete sculptures", - "precise water channels", - "megastructure of strange shape", + "monumental pristine concrete and white stone architecture", + "hypermodern flawless surfaces beside weathered ancient ruins", + "colossal enigmatic megastructure looming on the horizon", + "long colonnades of square columns", + "elevated walkways and straight causeways", + "monumental staircases and terraced platforms", + "freestanding gates and arched portals", + "open plazas and courtyards", + "obelisks and abstract concrete sculptures", + "precise water channels and reflecting pools", + "clean geometric forms at impossible scale", "distinct scales of objects, some very large for contrast", + "serene, deserted, contemplative", ], - help="Taste keywords for the LLM art-director prompt.", + help="Core aesthetic keywords shared across all biomes.", + ) + wall.add_argument( + "--taste-sample-frac", + type=float, + default=0.6, + help="Fraction of taste keywords randomly sampled per run; lower " + "values give more varied, less cluttered prompts.", + ) + wall.add_argument( + "--biomes", + nargs="+", + default=[ + "mediterranean coast: sun-bleached stone terraces, azure sea, rocky coastline, cypress and olive trees, warm limestone cliffs, salt haze over the water", + "verdant grassland: rolling green meadows, wildflowers and tall grass, gentle hills to the horizon, scattered broadleaf trees", + "autumn forest: dense woodland in golden and crimson foliage, fallen leaves, thin mist between trunks, damp moss-streaked surfaces", + "desert canyon: red sandstone canyons and mesas, wind-carved rock, ultra blue shallow water, strata, drifting dunes, dry heat shimmer, deep shadow in narrow ravines", + "arctic tundra: snowfields and frozen lakes, sheathing ice, sparse black rock breaking through snow, long blue shadows, frost haze", + "misty wetland: still black water and reed beds, low-hanging fog, half-submerged ground, mirror-flat reflections", + "volcanic wastes: black basalt plains, drifting ash, cooled lava flows, faint orange fissures, columnar basalt cliffs", + "tropical highlands: lush jungle terraces, waterfalls down cliff faces, climbing vines, humid haze, broad-leafed plants", + "megastructure interior: vast enclosed halls, endless repeating bays, shafts of light from distant openings, no vegetation", + ], + help="Biome descriptions; one is chosen at random per run and " + "injected as the dominant environment.", ) wall.add_argument( "--perspectives", nargs="+", default=[ "low ground-level view looking up", - "aerial view from great height", + "elevated view from great height, looking down", "interior view looking outward through an opening", - "interior view looking inward to a courtyard", - "distant view across open landscape, structures on the horizon", + "view into an enclosed courtyard or atrium", + "distant view across a vast open expanse, structures on the horizon", "in-situ view from within the structures, human eye level", - "view from across a body of water", - "view from a field", + "view from across still water or another flat reflective surface", + "view from flat open ground, structures rising ahead", "framed view through a narrow gap or corridor", ], help="Camera perspectives; one is chosen at random per run and " @@ -462,11 +494,16 @@ def parse_args() -> argparse.Namespace: "You are a wallpaper art director. " "Given the user's taste and the context, write one detailed text-to-image prompt for a diffusion model. " "You are repeatedly called upon to do this, and must introduce variation into your output. " - "The taste reference lists the themes to build on; improvise around them, or drop some. " - "The required perspective MUST be used as the camera viewpoint of the image. " + "The taste reference lists the architectural themes to build on; improvise around them, or drop some. " + "The required biome defines the landscape, vegetation, climate, and colour palette of the scene, " + "and MUST dominate the environment; blend the taste reference's structures into it. " + "The required perspective MUST be used as the camera viewpoint of the image; " + "ground it in the biome's terrain, adapting its details so the combination is physically coherent " + "(an open expanse may be sea, sand, snow, grass, or a vast hall floor depending on the biome). " "Times after sunset and before sunrise should generate dark images for night time. " "Times during the day should track the brightness of the hour. " - "The weather should be reflected in your prompt. " + "The weather should be reflected in your prompt where it does not contradict the biome; " + "the biome's climate wins any conflict. " "The season should set the overall mood of the prompt. " "Do not include the time, date, or location in your prompt. " "Output ONLY the image prompt — no explanation or preamble." @@ -487,7 +524,7 @@ def parse_args() -> argparse.Namespace: flux2.add_argument( "--flux2-klein-steps", type=int, - default=8, + default=5, help="Steps to use when generating image.", ) flux2.add_argument( @@ -557,6 +594,8 @@ def run() -> None: args.llm_system_prompt, args.llm_max_tokens, list(args.taste_prompt), + args.taste_sample_frac, + list(args.biomes), list(args.perspectives), args.llm_temperature, args.llm_top_p, @@ -606,8 +645,8 @@ def run() -> None: saved = step_save(upscaled, Path(args.ephemeral_dir).expanduser(), now, prompt_text) for p in saved: logger.info("Saved: %s", p.resolve()) - # 6. set wallpaper + # 6. set wallpaper step_wallpaper( args.set_command, saved, |
