save code

This commit is contained in:
colomi
2025-07-13 23:53:40 +08:00
parent bcebd31667
commit aa5fc8cbf1
2 changed files with 21 additions and 14 deletions
+8 -2
View File
@@ -38,7 +38,7 @@ def GetPicDesc(img_url):
"url": img_url
},
},
{"type": "text", "text": "图片是一件服装的照片,告诉我图片中的服装穿到正常人身上的长度会覆盖到人体的哪个部位, 只要答案, 选项有(胸、腰、跨、大腿、膝盖、小腿、脚踝、拖地、难以辨认)"},
{"type": "text", "text": "图片是一件服装的照片,返回为json格式, 第一个字段'服装长度', 图片中的服装穿到正常人身上的长度会覆盖到人体的哪个部位, 只要答案, 选项有(胸、腰、跨、大腿、膝盖、小腿、脚踝、拖地、难以辨认). 第二个字段'衣袖',只要答案,选项有(短袖、长袖)"},
],
}
],
@@ -51,7 +51,12 @@ def GetPicDesc(img_url):
def change(human_name, cloth_name, c_width, c_height, cloth_url):
cloth_len = GetPicDesc(cloth_url)
json_str = GetPicDesc(cloth_url)
json_data = json.loads(json_str)
cloth_len = json_data['服装长度']
cloth_short = True
if '长袖' in json_data['衣袖']:
cloth_short = False
if cloth_len == '难以辨认':
return None, "get image type error"
@@ -65,6 +70,7 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url):
prompt = json.loads(prompt_text)
prompt["96"]["inputs"]["cloth_len"] = cloth_len
prompt["96"]["inputs"]["cloth_short"] = cloth_short
# prompt["99"]["inputs"]["width"] = int((c_width/c_height) * 1024)