This commit is contained in:
2025-09-04 07:53:00 +08:00
parent eb55b52029
commit 16ef998ae9
4 changed files with 45 additions and 4 deletions

View File

@@ -5,8 +5,8 @@ class PuLIDGenerator:
def __init__(self): def __init__(self):
self.liblib_util = LibLibUtil() self.liblib_util = LibLibUtil()
# PuLID人像换脸参数示例 # PuLID人像换脸参数示例
self.template_uuid = "6f7c4652458d4802969f8d089cf5b91f"
self.default_params = { self.default_params = {
"templateUuid": "6f7c4652458d4802969f8d089cf5b91f",
"steps": 20, "steps": 20,
"width": 768, "width": 768,
"height": 1024, "height": 1024,
@@ -45,7 +45,7 @@ class PuLIDGenerator:
"""根据提示词和参考图片生成图像,并自动处理后续流程""" """根据提示词和参考图片生成图像,并自动处理后续流程"""
# 构建生成参数 # 构建生成参数
generate_params = { generate_params = {
"templateUuid": self.template_uuid, "templateUuid":self.default_params["templateUuid"],
"generateParams": { "generateParams": {
"prompt": prompt, "prompt": prompt,
**self.default_params, **self.default_params,

View File

@@ -1,10 +1,15 @@
from PuLIDGenerator import PuLIDGenerator from PuLIDGenerator import PuLIDGenerator
if __name__ == "__main__": if __name__ == "__main__":
# 创建生成器实例 # 创建生成器实例 - 传入模型IDtemplate_uuid
generator = PuLIDGenerator() generator = PuLIDGenerator()
# 可选:修改默认参数 # 可选:修改默认参数
generator.set_default_params(steps=25, width=800, height=1000) generator.set_default_params(
template_uuid="6f7c4652458d4802969f8d089cf5b91f",
steps=25,
width=800,
height=1000
)
# 生成图像 # 生成图像
obs_url = generator.generate_image( obs_url = generator.generate_image(
prompt="filmfotos, Asian portrait,A young woman wearing a green baseball cap,covering one eye with her hand", prompt="filmfotos, Asian portrait,A young woman wearing a green baseball cap,covering one eye with her hand",

View File

@@ -0,0 +1,36 @@
{
"models": [
{
"id": 1,
"name": "3D古风人物-春节场景",
"template_uuid": "e00dfcccc6014cf58dd6cb6a1dfae72f",
"default_params": {
"steps": 20,
"width": 856,
"height": 1536,
"sampler": "Euler",
"cfg": 3.5,
"imgCount": 1,
"seed": -1
},
"default_prompt": "a doll with long dark brown hair,brown eyes,and brown eyebrows is adorned with red flowers. She is dressed in a traditional Chinese dress,adorned with a white fur trim and a red ribbon around her neck. She's holding a red card in her left hand,with the word \"M\" written on it in a foreign language. Her right hand is positioned in front of her face,adding a touch of warmth to her outfit. In the background,a sofa set with red pillows is visible,adding depth to the scene. To the left of the sofa set,a small orange pumpkin is placed on a wooden table.",
"default_negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),EasyNegative,(worst quality:2)",
"description": "3D风格古风人物适合春节场景"
},
{
"id": 2,
"name": "Q版3D角色IP设计模型",
"template_uuid": "8bb797c6ca7e4309843a880f30dcb882",
"description": "Q版3D角色IP设计模型支持生成卡通风格角色形象",
"default_params": {
"size": "768x1024",
"sampler": "Euler a",
"steps": 20,
"cfg": 7,
"seed": -1
},
"default_prompt": "IP 3D c4d,chibi,Cute,monkey,dressed in street style clothing,wearing a duckbill cap,creative eyes,solid color background",
"default_negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),EasyNegative,(worst quality:2)"
}
]
}