Skip to main content

Create Dreambooth Request (Sandbox)

Overview

This endpoint is used to train a model based on custom images.

Request

--request POST 'https://stablediffusionapi.com/api/sandbox/v3/fine_tune' \

Make a POST request to https://stablediffusionapi.com/api/sandbox/v3/fine_tune endpoint and pass the required parameters in the request body.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization.
instance_promptText prompt with how you want to call your trained person/object.
class_promptClassification of the trained person/object.
imagesPass accessible direct links to images, cropped to 512 x 512 px. A good number is about 7-8 images.
seedSeed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number.
training_typeThe type of the object you are training on.
max_train_stepsSet it at 2 times the number of images (Ni*2; maximum value 2000).
webhookGet a post call when the training completes.

Training Types

The table below lists all the possible values for the training_type parameter.

ValueDescription
menTrain on faces of men.
femaleTrain on faces of females.
coupleTrain on couples of male and female; in images array pass images of couples, instead of images of a single person.
nullTrain on object or anything.

Example

Body

Body Raw
{
"key": "",
"instance_prompt": "photo of adhik person",
"class_prompt" : "photo of person",
"images": [
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00001.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00002.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00003.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00004.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00005.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00006.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00007.png"
],
"seed": "0",
"training_type": "men",
"max_train_steps": "2000",
"webhook": ""
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"instance_prompt": "photo of adhik person",
"class_prompt": "photo of person",
"images": [
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00001.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00002.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00003.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00004.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00005.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00006.png",
"https://stablediffusionapi.com/storage/avatars/AdhikJoshi_00007.png"
],
"seed": "0",
"training_type": "men",
"max_train_steps": "2000",
"webhook": ""
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://stablediffusionapi.com/api/sandbox/v3/fine_tune", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"messege": "deploying_gpu",
"data": "it will take upto 25 minutes.",
"training_id": "F5jvdzGnYi"
}