This commit is contained in:
2025-09-04 08:17:22 +08:00
parent 18d268847a
commit 68fa7a53b9
3 changed files with 34 additions and 9 deletions

View File

@@ -1,20 +1,31 @@
import json
from PuLIDGenerator import PuLIDGenerator from PuLIDGenerator import PuLIDGenerator
# 加载配置文件
with open('config.json', 'r', encoding='utf-8') as f:
config = json.load(f)
if __name__ == "__main__": if __name__ == "__main__":
# 创建生成器实例 - 传入模型IDtemplate_uuid # 获取第一个模型的配置
model_config = config["models"][0]
# 创建生成器实例
generator = PuLIDGenerator() generator = PuLIDGenerator()
# 可选:修改默认参数
# 使用配置参数
generator.set_default_params( generator.set_default_params(
template_uuid="6f7c4652458d4802969f8d089cf5b91f", template_uuid=model_config["template_uuid"],
steps=25, steps=model_config["steps"],
width=800, width=model_config["width"],
height=1000 height=model_config["height"]
) )
# 生成图像 # 生成图像
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=model_config["prompt"],
reference_image_url="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg", reference_image_url=model_config["reference_image_url"],
control_weight=0.8 control_weight=model_config["control_weight"]
) )
if obs_url: if obs_url:
print(f"最终OBS地址: {obs_url}") print(f"最终OBS地址: {obs_url}")

View File

@@ -0,0 +1,14 @@
{
"models": [
{
"name": "PuLID模型",
"template_uuid": "6f7c4652458d4802969f8d089cf5b91f",
"steps": 25,
"width": 800,
"height": 1000,
"prompt": "filmfotos, Asian portrait,A young woman wearing a green baseball cap,covering one eye with her hand",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
}
]
}