half-drop-demo / experiments /guided_prompt.py
Sean Powell
Make experiments consistent & use shared utils.
ad3f797
from utils import images, filenames, wallpaper, pipes
generation_dir = "./generations/guided_prompt"
inference_steps = 20
sdxl_pipe = pipes.create_stable_diffusion_xl_pipeline()
prompt_suffix = "-45 degree angle."
prompts = [
"seamless pattern of parrots. black and white, drawing, white background, seamless, ornament.",
"highly detailed black and white geometric pattern, repetition, hexagon, fractal, sacred geometry, sharp angles, "
"symmetry."
"spring flowers, happy and beautiful, by jackdaws and william morris, thick black line art, anime.",
"individual, one, cartoon-style, great horned owl standing on a branch, coloring page, black and white.",
"geometric pattern, orange background."
]
for prompt in prompts:
modified_prompt = f"{prompt} {prompt_suffix}"
print(f"using prompt: `{modified_prompt}`")
original_image = sdxl_pipe(prompt=modified_prompt, num_inference_steps=inference_steps).images[0]
original_image_filename = filenames.generate_filename(f"{generation_dir}/tiles", modified_prompt)
original_image.save(original_image_filename)
print("generated original image", original_image_filename)
rotated = images.rotate_image(original_image)
rotated_filename = filenames.generate_filename(f"{generation_dir}/rotations", modified_prompt, "_rotated")
rotated.save(rotated_filename)
print("generated rotation", rotated_filename)
half_drop = wallpaper.convert_tile_to_half_drop(original_image)
half_drop_filename = filenames.generate_filename(f"{generation_dir}/half_drops", modified_prompt,
"_half-drop-tile")
half_drop.save(half_drop_filename)
print("generated half drop", half_drop_filename)
half_drop_demo = wallpaper.generate_tile_test_arrangement(half_drop)
half_drop_demo_filename = filenames.generate_filename(f"{generation_dir}/half_drop_demos", modified_prompt,
"_half-drop-demo")
half_drop_demo.save(half_drop_demo_filename)
print("generated half drop demo", half_drop_demo_filename)