(worst quality, low quality:1.4), vibrant neon colors, high contrast, modern UI elements, glossy surface, plastic, cartoon, 3d render, photorealistic, oversaturated, noisy, busy background, text, watermark
(masterpiece, best quality), a serene Chinese landscape courtyard in early morning, <上述风格描述词>, warm parchment paper color scheme, minimalist aesthetic with ample empty space, soft diffused lighting, delicate ink wash effect, elegant tranquility
import torch
from diffusers import StableDiffusionXLPipeline, DPMSolverMultistepScheduler
from PIL import Image
model_path = "stabilityai/stable-diffusion-xl-base-1.0"
pipe = StableDiffusionXLPipeline.from_pretrained(
model_path,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16",
)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")
style_prompt_additions = (", warm parchment paper color scheme, muted and desaturated palette of ivory, ash and ink wash tones, minimalist composition with ample negative space, serene and contemplative atmosphere, delicate texture reminiscent of xuan paper, soft diffused lighting, elegant tranquility")
negative_prompt_style = "(worst quality, low quality:1.4), vibrant colors, neon, high contrast, modern, ui, glossy, plastic, cartoon, 3d render, photorealistic, oversaturated, noisy, busy background, text, watermark"
content_prompt = "a lonely boat on a misty lake surrounded by distant mountains"
full_prompt = f"(masterpiece, best quality, detailed), {content_prompt}{style_prompt_additions}"
print(f"生成提示词:{full_prompt[:100]}...")
image = pipe(
prompt=full_prompt,
negative_prompt=negative_prompt_style,
height=1024,
width=1024,
num_inference_steps=30,
guidance_scale=7.5,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("chinese_style_misty_lake.png")
print("图像已保存为 'chinese_style_misty_lake.png'")