'commit'
This commit is contained in:
45
dsLightRag/Liblib/T2_CopyFace.py
Normal file
45
dsLightRag/Liblib/T2_CopyFace.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import json
|
||||
|
||||
from Liblib.LibLibSamplingEnum import SAMPLING_METHODS
|
||||
from PuLIDGenerator import PuLIDGenerator
|
||||
|
||||
# 加载配置文件
|
||||
with open('image_data.json', 'r', encoding='utf-8') as f:
|
||||
config = json.load(f)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 获取第一个模型的配置
|
||||
model_config = config["models"][0]
|
||||
# 完成的例子
|
||||
# 炫酷机甲美女_majicflus
|
||||
# https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/bdde20e3143049c3916aa0b8d523b469.jpg
|
||||
# https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/ffe9051f1f1d4009a78c744b7e68747c.jpg
|
||||
# 卡通小人
|
||||
# https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/484eba61d6e74f8ea0cb3d8ff2d14341.jpg
|
||||
|
||||
# F.1-武侠世界
|
||||
# https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/215df7724cba4bf9a64e7863ecb4ebc0.jpg
|
||||
|
||||
# 通过枚举转换
|
||||
print(f'使用采样方法: {model_config["sampler"]}')
|
||||
model_config["sampler"] = SAMPLING_METHODS[model_config["sampler"]]
|
||||
# 创建生成器实例
|
||||
generator = PuLIDGenerator()
|
||||
|
||||
# 使用配置参数
|
||||
generator.set_default_params(
|
||||
template_uuid=model_config["template_uuid"],
|
||||
steps=model_config["steps"],
|
||||
width=model_config["width"],
|
||||
height=model_config["height"]
|
||||
)
|
||||
|
||||
# 生成图像
|
||||
obs_url = generator.generate_image(
|
||||
prompt=model_config["prompt"],
|
||||
reference_image_url=model_config["reference_image_url"],
|
||||
control_weight=model_config["control_weight"]
|
||||
)
|
||||
|
||||
if obs_url:
|
||||
print(f"最终OBS地址: {obs_url}")
|
Reference in New Issue
Block a user