From 73e356def754980f3cc85371302f400ab8fc64ed Mon Sep 17 00:00:00 2001 From: xsl Date: Sun, 2 Nov 2025 13:43:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=9B=BE=E7=89=87=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9C=89=E4=BA=BA=E8=84=B8=EF=BC=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=A1=A3=E6=9C=8D=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- change_app.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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}")