跳转到内容

執行 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

要套用特效的目標物件的零基索引。對於含多個物件的圖片,請先執行前處理任務,檢查 data.results.result 中的物件座標,並將所選物件的索引傳入此處。

前處理步驟會在套用任何特效之前,分析輸入圖片以識別所有可偵測的物件。它執行一個偵測任務,為每個物件回傳結構化資料,包含一個邊界框座標清單。清單中每個項目的位置,就是它的零基索引,隨後用於指定特效的目標物件。

這些資訊以結構化格式回傳,通常位於 data.results.result 之下。 先執行這個步驟,您可以:

  • 了解圖片中有多少物件
  • 檢查它們的位置與大小
  • 依索引選取正確的目標物件

對於含多個物件的圖片,務必執行前處理步驟。 檢視 data.results.result 以識別物件及其索引。 使用對應的零基索引選取正確的目標。

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

不可全為零

示例:
{ "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必需

要執行任務的檔案網址。該網址應可公開存取。

示例:"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" } }