diff --git a/change_app.py b/change_app.py index 374839c..79fe68a 100644 --- a/change_app.py +++ b/change_app.py @@ -101,6 +101,32 @@ def GetPicDesc(img_url): print(text) return text + +def GetPicHumanFace(img_url): + response = client.chat.completions.create( + # 指定您创建的方舟推理接入点 ID,此处已帮您修改为您的推理接入点 ID + model="doubao-1.5-vision-pro-250328", + messages=[ + { + "role": "user", + "content": [ + { + "type": "image_url", + "image_url": { + "url": img_url + }, + }, + {"type": "text", "text": "图片是一件有服装的照片,帮忙分析一下,返回为json格式, 字段名是'face_state', 图片是否有人脸或者人,有人或者人穿着衣服就返回'有人' 没有就返回'没人'"}, + ], + } + ], + + ) + + text = response.choices[0].message.content + print(text) + return text + def GetHumanDesDesc(img_url): response = client.chat.completions.create( # 指定您创建的方舟推理接入点 ID,此处已帮您修改为您的推理接入点 ID @@ -260,7 +286,11 @@ def change(human_name, cloth_name, c_width, c_height, cloth_url, human_url, no2, print(f'change 函数里面获取的 cloth_len') - + cloth_json_str = GetPicHumanFace(cloth_url) + print(f"cloth_json_str:{cloth_json_str}") + cloth_json_data = json.loads(cloth_json_str) + if cloth_json_data['face_state'] == '有人': + cloth_len = '拖地' print(f"tuodi:{tuodi}")