save code
This commit is contained in:
+19
-11
@@ -111,7 +111,7 @@ def GetHumanDesDesc(img_url):
|
||||
"url": img_url
|
||||
},
|
||||
},
|
||||
{"type": "text", "text": "图片是一个人物的照片,返回为json格式, 第一个字段'性别', 判断一下性别,只要答案, 选项有(男、女). 第二个字段'跨',判断一下图片中的人物是否拍摄到了胯的部分,只要答案,选项有(有、没)"},
|
||||
{"type": "text", "text": "图片是一个人物的照片,返回为json格式, 第一个字段'性别', 判断一下性别,只要答案, 选项有(男、女). 第二个字段'身高完整度',判断一下照片中人物的身高完整度(用小数表示)"},
|
||||
],
|
||||
}
|
||||
],
|
||||
@@ -133,7 +133,7 @@ def takeoff_cloth_first(human_name, is_girl):
|
||||
|
||||
prompt = json.loads(prompt_text)
|
||||
|
||||
prompt["96"]["inputs"]["cloth_len"] = '脚踝'
|
||||
prompt["96"]["inputs"]["cloth_len"] = '拖地'
|
||||
prompt["96"]["inputs"]["cloth_short"] = True
|
||||
|
||||
# prompt["99"]["inputs"]["width"] = int((c_width/c_height) * 1024)
|
||||
@@ -195,9 +195,9 @@ def generate_from_face(human_name, sex_girl):
|
||||
prompt["93"]["inputs"]["image"] = human_name
|
||||
|
||||
if sex_girl:
|
||||
prompt["6"]["inputs"]["text"] = "asian girl,full body shot(1.9),complete figure,front-facing,model pose,hands are at the sides of the body,smile,wearing black tube top and micro skirt,simple ,white background,32k,high detail,and face is illuminated by soft side light and natural light."
|
||||
prompt["6"]["inputs"]["text"] = "asian girl,full body shot(1.9),complete figure,front-facing,model pose,hands are at the sides of the body,smile,wearing black tube top and micro skirt,simple ,white background,32k,high detail,and face is illuminated by soft side light and natural light. The sunlight spills over the white wall behind."
|
||||
else:
|
||||
prompt["6"]["inputs"]["text"] = "asian man,full body shot(1.9),complete figure,front-facing,model pose,hands are at the sides of the body,smile,wearing black tight shortst,simple white background,32k,high detail,and face is illuminated by soft side light and natural light."
|
||||
prompt["6"]["inputs"]["text"] = "asian man,full body shot(1.9),complete figure,front-facing,model pose,hands are at the sides of the body,smile,wearing black tight shortst,simple white background,32k,high detail,and face is illuminated by soft side light and natural light. The sunlight spills over the white wall behind."
|
||||
|
||||
#out put name
|
||||
out_img_name = str(uuid.uuid4())[:8]
|
||||
@@ -241,10 +241,7 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2)
|
||||
if '男' in sex_type:
|
||||
sex_girl = False
|
||||
|
||||
kua = False
|
||||
if human_json_data['跨'] == '有':
|
||||
kua = True
|
||||
|
||||
sgwzd = human_json_data['身高完整度']
|
||||
|
||||
json_str = GetPicDesc(cloth_url)
|
||||
json_data = json.loads(json_str)
|
||||
@@ -255,14 +252,14 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2)
|
||||
if cloth_len == '难以辨认':
|
||||
return None, None, sex_girl, "get image type error"
|
||||
|
||||
if no2:
|
||||
if no2 == True:
|
||||
print(f'不用第二部 no2{no2}')
|
||||
else:
|
||||
print(f'要第二部 no2{no2} 先搞第一步')
|
||||
# thigh_visible = is_thigh_visible(f"/home/szlc/code/ComfyUI/input/{human_name}")
|
||||
if kua:
|
||||
if sgwzd > 0.5:
|
||||
#脱衣服
|
||||
takeoff_file_name = takeoff_cloth_first(human_name)
|
||||
takeoff_file_name = takeoff_cloth_first(human_name, sex_girl)
|
||||
if takeoff_file_name == None:
|
||||
return None, None, sex_girl, f"takeoff_cloth_first error {human_name}"
|
||||
else:
|
||||
@@ -546,7 +543,16 @@ def do_change_cloth():
|
||||
|
||||
output_format = data.get('output_format')
|
||||
|
||||
def check_type(var):
|
||||
if isinstance(var, bool):
|
||||
print(f"{var} 是布尔值no2")
|
||||
elif isinstance(var, str):
|
||||
print(f"'{var}' 是字符串no2")
|
||||
else:
|
||||
print(f"既不是字符串也不是布尔值no2,实际类型: {type(var)}")
|
||||
|
||||
no2 = data['no2']
|
||||
check_type(no2)
|
||||
|
||||
try:
|
||||
return process_change_cloth(human_filename, cloth_filename, output_format, cloth_url, human_url, no2)
|
||||
@@ -624,6 +630,8 @@ def change_cloth():
|
||||
if not no2:
|
||||
data['no2'] = False
|
||||
|
||||
print(f"change_cloth input data:{data}")
|
||||
|
||||
return queueCall(data)
|
||||
|
||||
@app.route('/change_cloth_base64', methods=['POST'])
|
||||
|
||||
Reference in New Issue
Block a user