Create Model

Creates a new model using a list of image URLs.

This operation costs 50 credits.

Endpoint

POST /api/models

Parameters

Parameter
Type
Required
Description

images

array[file]

Yes. Required if image_urls is not provided.

List of images representing the model's dataset. Must be a list on length 1 to 30.

image_urls

array[string]

Yes. Required if images is not provided.

List of image URLs representing the model's dataset. Must be a list on length 1 to 30.

gender

string

Yes

Possible values: woman, man.

model_type

string

Yes

Possible values: professional, amateur.

name

string

No

Name of the model

callback

string

No

A URL that will be called when the model is done training. If not provided, an email will be sent when it is trained.

Sending Images for Training

To create a new model, you need to send a list of images that will be used for training. You can send the images in two ways: by uploading the image files directly or by providing a list of image URLs.

  1. Uploading Image Files

To upload image files, you need to send a multipart/form-data request with the image files attached.

Example Request

Here's an example of how you can send a multipart/form-data request using curl:

curl -X POST \
  https://api.deepmode.ai/api/models \
  -H 'Authorization: Bearer YOUR_SECRET_API_KEY' \
  -H 'Content-Type: multipart/form-data' \
  -F 'images=@/path/to/image1.jpg' \
  -F 'images=@/path/to/image2.jpg' \
  -F 'images=@/path/to/image3.jpg' \
  -F 'gender=woman' \
  -F 'model_type=amateur'
  1. Providing Image URLs

Alternatively, you can provide a list of image URLs instead of uploading the image files directly. The request body should contain image_urls. The image URLs should be publicly accessible.

Example Request

Here's an example of how you can send a JSON request with a list of image URLs:

curl -X POST \
  https://api.deepmode.ai/api/models \
  -H 'Authorization: Bearer YOUR_SECRET_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "image_urls": [
          "https://example.com/image1.jpg",
          "https://example.com/image2.jpg",
          "https://example.com/image3.jpg"
        ],
        "gender": "woman",
        "model_type": "amateur"
      }'

Important Notes

  • The maximum number of images you can send is 30.

  • The images should be in one of the following formats: jpg, jpeg, png, webp, or heic.

  • The API will validate the images and return an error if any of the images are invalid or cannot be accessed.

Response

Upon successful creation, the API returns the following response:

// Response for request
{"message": "Created model successfully"}

// Response for callback
{
  "id": "c6b8a9f7e5d1c3a2f91e3",
  "name": "My model",
  "gender": "woman",
  "active": true,
  "created_at": "2024-04-01T12:00:00Z",
  "expire_at": "2024-05-01T12:00:00Z"
}

Last updated