跳转到内容

执行 AI 面部塑形 任务。

请求

AI 任务是异步处理的。功能支持 Webhook 时,优先用 Webhook 来接收完成通知。配置好您的 Webhook 端点、校验 Webhook 签名,收到 success 或 error 通知后,用收到的 task_id 查询任务结果。配置与校验的细节请见 Webhook 接入指南。

若功能不支持 Webhook,或您的接入方式用不了 Webhook,就请实现轮询。提交 AI 任务后,按固定间隔(例如每 10 秒)轮询状态接口,直到任务状态变为 success 或 error。

安全
BearerAuthenticationV2
正文application/json必需
Any of:
versionstring必需

功能规格的版本号。 未特别指定时默认为 "1.0"。

默认值:"1.0"
示例:"1.0"
indexinteger

要施加特效的目标对象的下标,从 0 开始。图中存在多个对象时,请先运行预处理任务,在 data.results.result 中查看各对象的坐标,再把您选定对象的下标传到这里。

预处理这一步会在施加任何特效之前,先分析输入图片、识别出所有可检测的对象。它运行的是一个检测任务,为每个对象返回结构化数据,其中包含一组边界框坐标。列表中每一项的位置就是它的下标(从 0 开始),后续就用这个下标来指定特效要作用的目标对象。

这些信息以结构化格式返回,通常位于 data.results.result 之下。 先做这一步,您可以:

  • 了解图中一共有多少个对象
  • 查看它们的位置与大小
  • 按下标选出正确的目标对象

图中存在多个对象时,请务必先运行预处理这一步。 查看 data.results.result,确认有哪些对象以及各自的下标。 用对应的下标(从 0 开始)选中正确的目标。

默认值:0
示例:0
featuresobject, non-empty(FaceReshapeLipFeature)必需

不能全为 0

示例:
{ "cheekbones": 0, "jaw": 0, "face_reshape": 0, "face_reshape_left": 0, "face_reshape_right": 0, "face_width": 0, "chin_reshape": 0, "chin_reshape_left": 0, "chin_reshape_right": 0, "chin_length": 0, "eye_size": 0, "eye_size_left": 0, "eye_size_right": 0, "eye_distance": 0, "eye_angle": 0, "eye_height": 0, "eye_width": 0, "nose_bridge_width": 0, "nose_lift": 0, "nose_size": 0, "nose_tip": 0, "nose_tip_width": 0, "nose_wing": 0, "lip_size": 0, "lip_width": 0, "lip_peak": 0, "lip_height_top": 0, "lip_height_bottom": 0 }
globalobject必需

磨皮设置

src_file_urlstring必需

用于运行任务的文件 URL,该 URL 需可公开访问。

示例:"https://example.com/selfie.jpg"
curl -i -X POST \
  https://yce-api-01.makeupar.com/s2s/v2.0/task/face-reshape \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "src_file_url": "https://example.com/selfie.jpg",
    "version": "1.0",
    "index": 0,
    "features": {
      "cheekbones": 0,
      "jaw": 0,
      "face_reshape": 0,
      "face_reshape_left": 0,
      "face_reshape_right": 0,
      "face_width": 0,
      "chin_reshape": 0,
      "chin_reshape_left": 0,
      "chin_reshape_right": 0,
      "chin_length": 0,
      "eye_size": 0,
      "eye_size_left": 0,
      "eye_size_right": 0,
      "eye_distance": 0,
      "eye_angle": 0,
      "eye_height": 0,
      "eye_width": 0,
      "nose_bridge_width": 0,
      "nose_lift": 0,
      "nose_size": 0,
      "nose_tip": 0,
      "nose_tip_width": 0,
      "nose_wing": 0,
      "lip_size": 0,
      "lip_width": 0,
      "lip_peak": 0,
      "lip_height_top": 0,
      "lip_height_bottom": 0
    },
    "global": {
      "skin_smooth_strength": 50,
      "skin_smooth_color_intensity": 50
    }
  }'

响应

任务执行成功

正文application/json
statusinteger

响应状态

示例:200
dataobject
响应
{ "status": 200, "data": { "task_id": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe" } }