Dreambooth API — how to train your model with our API

You can request and interfere custom dreambooth model

First, make sure you've read Getting Started guide and you have your API token ready.

Training preparation

Prepare minimum 20 (up to 100) photos of the person or the object you want to train model with. The more images you choose, the better the output quality will be.

Recommendations:

  • Upload images with different angles, backgrounds, lighting conditions, and poses
  • Shoulders should be visible, no sunglasses, different emotions, and backgrounds will help
  • Please use a single object per uploaded image
  • Later, uploaded images will be automatically removed

Once photos are selected, you need to upload them to the cloud. Don't worry, nobody have access to them. We will remove them in 24-48 hours after upload automatically.

Photos upload

Please read "Files Upload" section of this documentation.

For each file we are going to upload, we need to generate special unique presigned URL.

To do that you need to request /upload endpoint and pass file extension and mime-type. We hope these parameters will not be new to you.

Let's do this with curl:

curl --request POST \
     --url https://api.neural.love/v1/upload \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '{
     "extension": "jpg",
     "contentType": "image/jpeg"
}'

You will receive two parameters in response. First we will need url to upload the file, and s3Url to make a training request.

Let's upload our files. For each of them just use url to upload:

curl --request PUT \
     --url '<url>' \
     --upload-file '/path/to/file/on/your/computer.jpg'

Training

After you upload all files you can start training the model:

curl --request POST \
     --url https://api.neural.love/v1/ai-art/custom-model/create \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '{
     "name": "Just me",
     "class": "woman",
     "sources": [
       "s3://prod-incoming-saas-neural-love/f1bb412a20db/1ed71c42-2322-62dc-b332-3b2bd6c1f04e.jpg",
       "s3://prod-incoming-saas-neural-love/f1bb412a20db/1ed71c9d-c002-63f8-b12a-83521ccdb63c.jpg",
       "etc"
     ]
}'

After successful request (you'll get orderId to use later) please wait 90-120 minutes until the model will be ready. We use slower, but better quality training process to deliver best possible results.

Status check

Please use /ai-art/custom-model/models request to get all your models. Status could be either 250 for trained or 50 for the model in progress. Use id to distinguish models.

Generate with this model

Follow tutorial How to generate AI art with neural.love API but add customModelId with model id to request to generate art based on this model. All generations with custom model are private.

Cost estimation

You can use the very same parameters to estimate cost of training beforehand. Use /ai-art/custom-model/estimate endpoint to get training cost in credits.