This commit is contained in:
2025-09-04 10:59:06 +08:00
parent d8f409f567
commit 25d80f2524
4 changed files with 41 additions and 111 deletions

View File

@@ -1,5 +1,4 @@
from Liblib.LibLibGenerator import LibLibGenerator
import Config.Config
if __name__ == '__main__':
generate_params = {
@@ -23,43 +22,10 @@ if __name__ == '__main__':
}
liblib = LibLibGenerator()
# 调用生成接口
response = liblib.post_request(
"/api/generate/webui/text2img",
generate_params
)
if response and "generateUuid" in response:
generate_uuid = response["generateUuid"]
print(f"✅ 图像生成任务已成功提交生成UUID: {generate_uuid}")
print("开始轮询生成状态...")
# 等待生成完成每2秒检查一次
status_data = liblib.wait_for_generation_completion(generate_uuid, interval=2)
# 检查生成状态
if status_data and status_data.get("generateStatus") == 5:
print("🎉 图像生成完成!开始处理文件...")
# 提取图片URL
if status_data.get("images") and len(status_data["images"]) > 0:
image_url = status_data["images"][0]["imageUrl"]
# 下载并上传到OBS
obs_object_key = liblib.download_and_upload_to_obs(image_url, generate_uuid)
if obs_object_key:
# 构建完整的OBS URL
file_url = f"https://{Config.Config.OBS_BUCKET}.{Config.Config.OBS_SERVER}/{obs_object_key}"
print(f"✅ 文件处理完成OBS地址: {file_url}")
else:
print("❌ 文件上传OBS失败")
else:
print("❌ 未找到生成的图片数据")
else:
error_msg = status_data.get('message', '未知错误') if status_data else '生成状态查询失败'
print(f"❌ 图像生成失败: {error_msg}")
else:
error_msg = response.get('message', '未知错误') if response else 'API无响应'
print(f"❌ 图像生成失败: {error_msg}")
# {'generateUuid': 'f16463d55e144214ae12d5177f8256fc'}
print(response)

View File

@@ -4,7 +4,7 @@ from Liblib.LibLibSamplingEnum import SAMPLING_METHODS
from PuLIDGenerator import PuLIDGenerator
# 加载配置文件
with open('config.json', 'r', encoding='utf-8') as f:
with open('image_data.json', 'r', encoding='utf-8') as f:
config = json.load(f)
if __name__ == "__main__":

View File

@@ -1,46 +0,0 @@
{
"models": [
{
"name": "炫酷机甲美女_majicflus",
"template_uuid": "3867524e021e4669b83aa43a03c4d0fe",
"steps": 30,
"width": 920,
"height": 1280,
"cfgScale": 3.5,
"sampler": "DPM2",
"seed": -1,
"prompt": "(masterpiece, best quality:1.2),1 girl,arm cannon,armor,cyberpunk,cyborg,glow,body complex,all mechanical body,realistic metallic sheen,all body multi-camera style mech,helmets,mechs,Power Suits,science fiction,",
"negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),(worst quality:2),(low quality:2),(normal quality:2),lowres,bad anatomy,(bad hands),watermark,many fingers,(broken hands),nsfw,EasyNegative,skin blemishes,(ugly:1.331),(duplicate:1.331),(morbid:1.21),(mutilated:1.21),mutated hands,(poorly drawn hands:1.5),(bad anatomy:1.21),(bad proportions:1.331),extra limbs,(disfigured:1.331),(extra legs:1.331),(fused fingers:1.61051),(too many fingers:1.61051),(unclear eyes:1.331),lowers,bad hands,missing fingers,extra digit,bad hands,missing fingers,(((extra arms and legs))),nsfw,",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
},
{
"name": "可铯AI—3d潮玩手办",
"template_uuid": "bc6863e816f44cb28062dda9ef616bca",
"steps": 30,
"width": 720,
"height": 1280,
"cfgScale": 3.5,
"sampler": "Euler",
"seed": -1,
"prompt": "3d,this image is a highly detailed,digital cgi rendering of a chibi-style character set against a blurred,domestic background,the centerpiece is a young,wide-eyed,anime-inspired girl with exaggeratedly large blue eyes,a small nose,and rosy cheeks,her dark,tousled hair is stylized with a large,red bow on the back and a few small stars clipped into her hair,enhancing a playful,whimsical appearance, the girl is dressed in a cozy,multicolored sweater that reads sweet in orange,featuring a rainbow stripe pattern underneath,suggestive of the brand cotton candy,she also wears red tights that extend up to mid-thigh,black shoes with thick soles,and is secured with black straps and a small belt-like accessory,the footwear is practical in design,resembling sturdy,athletic sneakers, the background is minimalist and softly blurred to ensure the chibi character stands out prominently,it hints at a cozy,modern room with light-colored wooden flooring and furniture,including a partial view of a bookshelf to the left and a large,beige wardrobe to the right,the overall atmosphere is serene and warm,with the cgi maintaining a soft,almost ethereal glow,contributing to the innocent,playful vibe of the image,",
"negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),EasyNegative,(worst quality:2),",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
}
,
{
"name": "F.1-武侠世界",
"template_uuid": "320b97ec97dd4d7e9e30364b467e6dc3",
"steps": 20,
"width": 896,
"height": 1200,
"cfgScale": 1,
"sampler": "Euler",
"seed": 4170146039,
"prompt": "<lora:F.1-武侠世界:0.8>,dynamic blur,long exposure,close-up,a super realistic handsome chinese ranger girl,a chinese knight holding a chinese sword in the bamboo forest,chinese style chinese sword,martial arts movements,wearing tang dynasty clothing,super realistic,many details,luminous effect,high detail close-up lens (ecu),unreal engine engine,quixel megascans rendering,3d effect,",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
}
]
}

View File

@@ -1,36 +1,46 @@
{
"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风格古风人物适合春节场景"
"name": "炫酷机甲美女_majicflus",
"template_uuid": "3867524e021e4669b83aa43a03c4d0fe",
"steps": 30,
"width": 920,
"height": 1280,
"cfgScale": 3.5,
"sampler": "DPM2",
"seed": -1,
"prompt": "(masterpiece, best quality:1.2),1 girl,arm cannon,armor,cyberpunk,cyborg,glow,body complex,all mechanical body,realistic metallic sheen,all body multi-camera style mech,helmets,mechs,Power Suits,science fiction,",
"negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),(worst quality:2),(low quality:2),(normal quality:2),lowres,bad anatomy,(bad hands),watermark,many fingers,(broken hands),nsfw,EasyNegative,skin blemishes,(ugly:1.331),(duplicate:1.331),(morbid:1.21),(mutilated:1.21),mutated hands,(poorly drawn hands:1.5),(bad anatomy:1.21),(bad proportions:1.331),extra limbs,(disfigured:1.331),(extra legs:1.331),(fused fingers:1.61051),(too many fingers:1.61051),(unclear eyes:1.331),lowers,bad hands,missing fingers,extra digit,bad hands,missing fingers,(((extra arms and legs))),nsfw,",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
},
{
"id": 2,
"name": "Q版3D角色IP设计模型",
"template_uuid": "8bb797c6ca7e4309843a880f30dcb882",
"description": "Q版3D角色IP设计模型支持生成卡通风格角色形象",
"default_params": {
"size": "768x1024",
"sampler": "Euler a",
"name": "可铯AI—3d潮玩手办",
"template_uuid": "bc6863e816f44cb28062dda9ef616bca",
"steps": 30,
"width": 720,
"height": 1280,
"cfgScale": 3.5,
"sampler": "Euler",
"seed": -1,
"prompt": "3d,this image is a highly detailed,digital cgi rendering of a chibi-style character set against a blurred,domestic background,the centerpiece is a young,wide-eyed,anime-inspired girl with exaggeratedly large blue eyes,a small nose,and rosy cheeks,her dark,tousled hair is stylized with a large,red bow on the back and a few small stars clipped into her hair,enhancing a playful,whimsical appearance, the girl is dressed in a cozy,multicolored sweater that reads sweet in orange,featuring a rainbow stripe pattern underneath,suggestive of the brand cotton candy,she also wears red tights that extend up to mid-thigh,black shoes with thick soles,and is secured with black straps and a small belt-like accessory,the footwear is practical in design,resembling sturdy,athletic sneakers, the background is minimalist and softly blurred to ensure the chibi character stands out prominently,it hints at a cozy,modern room with light-colored wooden flooring and furniture,including a partial view of a bookshelf to the left and a large,beige wardrobe to the right,the overall atmosphere is serene and warm,with the cgi maintaining a soft,almost ethereal glow,contributing to the innocent,playful vibe of the image,",
"negative_prompt": "ng_deepnegative_v1_75t,(badhandv4:1.2),EasyNegative,(worst quality:2),",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
}
,
{
"name": "F.1-武侠世界",
"template_uuid": "320b97ec97dd4d7e9e30364b467e6dc3",
"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)"
"width": 896,
"height": 1200,
"cfgScale": 1,
"sampler": "Euler",
"seed": 4170146039,
"prompt": "<lora:F.1-武侠世界:0.8>,dynamic blur,long exposure,close-up,a super realistic handsome chinese ranger girl,a chinese knight holding a chinese sword in the bamboo forest,chinese style chinese sword,martial arts movements,wearing tang dynasty clothing,super realistic,many details,luminous effect,high detail close-up lens (ecu),unreal engine engine,quixel megascans rendering,3d effect,",
"reference_image_url": "https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/Backup/HuangWanQiao.jpg",
"control_weight": 0.8
}
]
}