API For Multiple Face Swap

Considerations

  1. Before using the API, make sure you have obtained the API key. Refer to the link below for instructions on how to obtain it. API For API Key Settings
  2. All generated images will be automatically deleted after 24 hours. Please make sure to save the images you need to your local storage in a timely manner.

Using Tutorials

Step 1: Call the create-detect API to Obtain Face Coordinates in the Image

  • First, use the create-detect API to detect faces in the image and obtain their coordinates.

Step 2: Determine the Positions of Faces in the Image

  • Utilize the face coordinates returned in Step 1 to determine the positions of each face in the image.

Step 3: Replace Faces in the Image

  • Replace the faces in the image as needed, following the sequence determined in Step 2,,If you do not want to replace the face, please upload the original face.

Step 4: Package the Replaced Faces into a ZIP File

  • Package the replaced face images into a ZIP file for further processing and transmission.

Step 5: Call the create-swap API to Perform Face Swapping

  • Use the create-swap API to perform the face swapping operation on the replaced images.

Step 6: Query the Face Swapping Result

  • Query the status and result of the face swapping task using the corresponding query endpoint.

Header Attributes

ParameterDescription
AuthorizationYour API Key used for request authorization.

Create Detect Job

Request Url

--request POST https://developer.remaker.ai/api/remaker/v1/face-detect/create-detect

Body Attributes

ParameterDescription
target_imageFace to be replaced(binary )

demo

import requests

url = 'https://developer.remaker.ai/api/remaker/v1/face-detect/create-detect'
headers = {
    'accept': 'application/json',
    'Authorization': 'your api-key',
}

files = {
    'target_image': open('demo1.jpg', 'rb')
}

response = requests.post(url, headers=headers, files=files)
print(response.json())

Create Swap Job

Request Url

--request POST https://developer.remaker.ai/api/remaker/v1/face-detect/create-swap

Body Attributes

ParameterDescription
target_imageFace to be replaced(binary )
model_faceYour Face(zip binary )

demo

import requests

url = 'https://developer.remaker.ai/api/remaker/v1/face-detect/create-swap'
headers = {
    'accept': 'application/json',
    'Authorization': 'your api-key',
}

files = {
    'target_image': open('demo1.jpg', 'rb')
    'model_face': open('demo1.zip', 'rb')
}

response = requests.post(url, headers=headers, files=files)
print(response.json())

Fetch Job

Request Url

--request GET https://developer.remaker.ai/api/remaker/v1/face-detect/face-detect/{job_id}

Body Attributes

ParameterDescription
job_idjob_id returned by create task

demo

import requests

url = 'https://developer.remaker.ai/api/remaker/v1/face-detect/face-detect/a4274b95-31d0-4cca-8a84-8c328f6b4ace'
headers = {
    'accept': 'application/json'
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"error: {response.status_code}")


Response

{
  "code": 200000,
  "result": {
    "job_id": "6039669e-498b-4c44-9ed7-08f19f14f4d0"
  },
  "message": {
    "en": "Request Failure."
  }
}
{
  "code": 100000,
  "result": {
    "output_image_url": [
      "https://image.remaker.ai/datarm/api/face-detect/2024-03-05/output/tmppgbmmyh4.png"
    ],
    "input_image_url": [
      "https://image.remaker.ai/datarm/api/face-detect/2024-03-05/input/6039669e-498b-4c44-9ed7-08f19f14f4d0_original_.png"
    ],
    "job_id": "6039669e-498b-4c44-9ed7-08f19f14f4d0",
    "message": ""
  },
  "message": {
    "en": "Image generated successfully."
  }
}
Last Updated: