
大家好我是专注AI潮汕IP设计的小江。最近很多烘焙店和奶茶店老板问我如何用AI低成本生成一套既有潮汕特色又能直接商用的国潮甜品IP今天分享一套我最近设计的“带炸英歌”系列不仅视觉炸裂而且寓意极佳下半炸英旺 下半年兴旺。很多人用AI画图最大的痛点是“抽卡”无法精准控制文字和元素。为了解决这个问题我编写了Python脚本结合ComfyUI工作流实现了对IP形象的精准控制。import torchfrom diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler# 1. 初始化SDXL模型加载器def load_sdxl_model(model_path):pipe StableDiffusionXLPipeline.from_pretrained(model_path,torch_dtypetorch.float16,use_safetensorsTrue,variantfp16)pipe.scheduler EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)return pipe.to(cuda)# 2. 定义潮汕国潮IP的专属Prompt模板# 这里的关键词是经过几百次测试筛选出来的能保证生成“萌系”且“喜庆”的风格PROMPT_TEMPLATE (masterpiece, best quality), 3d render, c4d style, blind box toy style,cute chaozhou red peach cake character wearing yingge dance costume,holding small flags, standing on a latte art coffee cup,festive atmosphere, chinese new year elements, Fu character decoration,coconut trees background, bright lighting, commercial product photography,--ar 3:4# 3. 批量生成并自动保存def generate_ip_batch(pipe, count5):for i in range(count):image pipe(promptPROMPT_TEMPLATE,negative_promptugly, deformed, noisy, blurry, distorted, text error, # 负面提示词很重要guidance_scale7.5,num_inference_steps30).images[0]# 自动命名保存方便后续整理交付给客户save_path f./output/chaoshan_ip_{i1}.pngimage.save(save_path)print(f成功生成: {save_path})if __name__ __main__:# 实际运行时调用# model load_sdxl_model(your_model_path)# generate_ip_batch(model)pass