Appearance scoring (predict)
Endpoint
- - Method: INLINECODE0
- URL: INLINECODE1
- Content-Type: INLINECODE2
- Field:
image (required; image file; use a real image MIME such as image/jpeg) - Query: Omit; server defaults apply.
Response JSON
Top level:
- -
code: 200 means success - INLINECODE7 : human-readable status text
- INLINECODE8 : present on success; may be incomplete on failure
Inside data:
- -
count: number of scored faces - INLINECODE11 :
{ "width", "height" } of the original image in pixels - INLINECODE13 : array of items with:
-
region:
{ x1, y1, x2, y2, width, height } in original-image pixels
-
score: float; you may
round for display
On errors or no faces, read message; data.faces may be empty.
Examples
curl
CODEBLOCK0
Python
CODEBLOCK1
Agent rules
- 1. Upload only via multipart field
image; do not append query params; do not switch to JSON/Base64 unless the API docs explicitly say so. - When multiple faces are present, sort by
region.x1 (left-to-right) before reporting scores. - On failure, surface
message and the HTTP status first.
外貌评分(预测)
端点
- - 方法:POST
- URL:https://synerunify.com/api/process/appearance/predict
- 内容类型:multipart/form-data
- 字段:image(必填;图片文件;使用真实图片MIME类型,如image/jpeg)
- 查询参数:省略;使用服务器默认值。
响应JSON
顶层:
- - code:200表示成功
- message:人类可读的状态文本
- data:成功时存在;失败时可能不完整
data内部:
- - count:已评分的人脸数量
- size:原始图像的{ width, height }(像素)
- faces:包含以下内容的项目数组:
- region:原始图像像素中的{ x1, y1, x2, y2, width, height }
- score:浮点数;显示时可进行round取整
出现错误或无人脸时,请读取message;data.faces可能为空。
示例
curl
bash
curl -sS -X POST https://synerunify.com/api/process/appearance/predict \
-F image=@/path/to/photo.jpg
Python
python
import requests
url = https://synerunify.com/api/process/appearance/predict
with open(photo.jpg, rb) as f:
r = requests.post(url, files={image: (photo.jpg, f, image/jpeg)}, timeout=120)
r.raiseforstatus()
payload = r.json()
if payload.get(code) != 200:
raise RuntimeError(payload.get(message, API error))
faces = payload[data][faces]
scores = [round(f[score]) for f in sorted(faces, key=lambda x: x[region][x1])]
Agent规则
- 1. 仅通过multipart字段image上传;不要附加查询参数;除非API文档明确说明,否则不要切换到JSON/Base64。
- 当存在多张人脸时,在报告评分前按region.x1(从左到右)排序。
- 失败时,首先显示message和HTTP状态。