跳转到内容

V1.0

AI 替換物件 API 可讓您使用生成式填充技術,替換圖片中的特定物件。需要來源照片、要替換區域的遮罩,以及描述應生成內容的文字提示。

執行 AI 替換物件任務。

请求

查詢任務狀態請參考輪詢指南。這個 API 需要來源照片、遮罩檔案,以及描述應替換遮罩區域內容的提示。

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

用於在遮罩區域生成物件的提示。

示例:"a cute cat"
src_file_urlstring必需

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

示例:"https://example.com/selfie.jpg"
msk_file_urlstring必需

遮罩檔案的網址。這必須是一張與輸入圖片寬高完全相同的灰階遮罩圖片,白色像素代表前景,黑色像素代表背景。該網址需可公開存取。

示例:"https://example.com/mask.jpg"
curl -i -X POST \
  https://yce-api-01.makeupar.com/s2s/v2.0/task/obj-replace \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "src_file_url": "https://example.com/selfie.jpg",
    "msk_file_url": "https://example.com/mask.jpg",
    "prompt": "a cute cat"
  }'

响应

任務執行成功

正文application/json
statusinteger

回應狀態

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