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
+13 -12
View File
@@ -1,7 +1,7 @@
{ {
"3": { "3": {
"inputs": { "inputs": {
"seed": 712463095845292, "seed": 578821909416451,
"steps": 20, "steps": 20,
"cfg": 1, "cfg": 1,
"sampler_name": "euler", "sampler_name": "euler",
@@ -196,7 +196,7 @@
}, },
"22": { "22": {
"inputs": { "inputs": {
"image": "cloth_short.jpg" "image": "微信图片_20250713223619.jpg"
}, },
"class_type": "LoadImage", "class_type": "LoadImage",
"_meta": { "_meta": {
@@ -486,7 +486,7 @@
}, },
"61": { "61": {
"inputs": { "inputs": {
"image": "girl_full.jpg" "image": "微信图片_20250713223607.jpg"
}, },
"class_type": "LoadImage", "class_type": "LoadImage",
"_meta": { "_meta": {
@@ -639,7 +639,7 @@
}, },
"94": { "94": {
"inputs": { "inputs": {
"value": 1024 "value": 2048
}, },
"class_type": "PrimitiveInt", "class_type": "PrimitiveInt",
"_meta": { "_meta": {
@@ -667,8 +667,9 @@
}, },
"96": { "96": {
"inputs": { "inputs": {
"cloth_len": "yao", "cloth_len": "小腿",
"line_len": 0.6000000000000001, "line_len": 0.6000000000000001,
"cloth_short": true,
"kps": [ "kps": [
"95", "95",
1 1
@@ -818,7 +819,7 @@
}, },
"110": { "110": {
"inputs": { "inputs": {
"preview": "", "preview": "1638400",
"source": [ "source": [
"106", "106",
0 0
@@ -831,7 +832,7 @@
}, },
"111": { "111": {
"inputs": { "inputs": {
"preview": "", "preview": "2048",
"source": [ "source": [
"108", "108",
0 0
@@ -844,7 +845,7 @@
}, },
"112": { "112": {
"inputs": { "inputs": {
"preview": "", "preview": "2048",
"source": [ "source": [
"109", "109",
0 0
@@ -857,7 +858,7 @@
}, },
"113": { "113": {
"inputs": { "inputs": {
"preview": "", "preview": "4096",
"source": [ "source": [
"107", "107",
0 0
@@ -870,7 +871,7 @@
}, },
"114": { "114": {
"inputs": { "inputs": {
"preview": "", "preview": "2048",
"source": [ "source": [
"107", "107",
1 1
@@ -883,7 +884,7 @@
}, },
"115": { "115": {
"inputs": { "inputs": {
"preview": "", "preview": "800",
"source": [ "source": [
"104", "104",
0 0
@@ -896,7 +897,7 @@
}, },
"116": { "116": {
"inputs": { "inputs": {
"preview": "", "preview": "800",
"source": [ "source": [
"104", "104",
1 1
+8 -2
View File
@@ -38,7 +38,7 @@ def GetPicDesc(img_url):
"url": 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): 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 == '难以辨认': if cloth_len == '难以辨认':
return None, "get image type error" 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 = json.loads(prompt_text)
prompt["96"]["inputs"]["cloth_len"] = cloth_len prompt["96"]["inputs"]["cloth_len"] = cloth_len
prompt["96"]["inputs"]["cloth_short"] = cloth_short
# prompt["99"]["inputs"]["width"] = int((c_width/c_height) * 1024) # prompt["99"]["inputs"]["width"] = int((c_width/c_height) * 1024)