Description
This route allows you to generate images using a tailored model. tailored models are trained using your own datasets to create unique illustrative visual styles or single-subject illustrations. You can train a tailored model through the API or using the Bria platform.
The Tailored Model API provides a set of endpoints to manage the entire lifecycle of a Tailored model:
Dataset Management: Create and manage datasets which will be used to train your tailored models. You can:
/datasets
endpoint to create a new dataset or retrieve existing datasets that belong to the client organization./datasets/{dataset_id}/images
endpoint to upload a new image to a dataset or retrieve existing images that belong to the dataset./datasets/{dataset_id}/images/{image_id}
endpoint to get or delete a specific image from a dataset.Model Management: Create and manage models based on your datasets. You can:
/models
endpoint to create a new model or retrieve all models that belong to the client organization./models/{id}
endpoint to retrieve a specific model by its ID or delete a specific model.Training Management: Start and stop training jobs for your models. You can:
/models/{id}/start_training
endpoint to initiate the training process. Note that the dataset must include the minimum required number of images and have a status of 'completed' before training can start./models/{id}/stop_training
endpoint to stop a training job for a model.Image Generation: Generate images using a trained model. You can:
/text-to-image/tailored/{model_id}
endpoint to generate images./text-to-vector/tailored/{model_id}
endpoint to generate vector graphics.To train a tailored model via the API:
/datasets
endpoint to create a dataset./datasets/{dataset_id}/images
endpoint./models
endpoint to create a model associated with your dataset./models/{id}/start_training
endpoint. Training of a tailored model takes between 1-3 hours./text-to-vector/tailored/{model_id}
route to generate vector graphics.Alternatively, you can use the Bria platform to manage and train your tailored models through a user-friendly interface. Access the Bria platform here.
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images, allowing for more precise and controlled image generation.
Importantly, users can provide any image they want as input. Our pipeline automatically transforms the input image according to the selected guidance method. For example, if you choose the depth guidance method, our pipeline will extract a depth map from your provided image and use it during the generation inference.
Currently, we support the following guidance methods:
controlnet_canny: Extracts edge information from the input image to guide generation based on structural outlines.
controlnet_depth: Derives depth information from the input image to influence spatial arrangement in generated images.
controlnet_recoloring: Uses grayscale version of the input image to guide recoloring while preserving geometry.
controlnet_color_grid: Extracts a 16x16 color grid from the input image to guide the overall color scheme of generated images.
Using Guidance Methods
You can specify up to four guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
Guidance Method | Prompt | Scale | Input Image | Guidance Image | Output Image |
---|---|---|---|---|---|
ControlNet Canny | An exotic colorful shell on the beach | 1.0 | |||
ControlNet Depth | A dog, exploring an alien planet | 0.8 | |||
ControlNet Recoloring | A vibrant photo of a woman | 1.00 | |||
ControlNet Color Grid | A dynamic fantasy illustration of an erupting volcano | 0.7 |
Note: When using multiple guidance methods, all input images must have the same aspect ratio, which will determine the aspect ratio of the generated results.
To use a guidance method, include the following parameters in your request:
guidance_method_X
: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
guidance_method_X_scale
: Set the impact of the guidance (0.0 to 1.0)
guidance_method_X_image_file
: Provide the base64-encoded input image
By leveraging these guidance methods, you can achieve more precise control over the generated images, tailoring them to your specific needs and creative vision.
Successful operation.
Bad request.
Method not allowed.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
Description
This route allows you to generate vector graphics using a tailored model. Tailored models are trained using your own datasets to create unique illustrative visual styles or single-subject illustrations. To see a detailed description of the tailored models' functionalities, please refer to the /text-to-image/tailored/{model_id} route documentation. *Text-to-vector is compatible with tailored models in the illustrative domain.
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images, allowing for more precise and controlled image generation.
Importantly, users can provide any image they want as input. Our pipeline automatically transforms the input image according to the selected guidance method. For example, if you choose the depth guidance method, our pipeline will extract a depth map from your provided image and use it during the generation inference.
Currently, we support the following guidance methods:
Using Guidance Methods You can specify up to four guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. Note: When using multiple guidance methods, all input images must have the same aspect ratio, which will determine the aspect ratio of the generated results. To use a guidance method, include the following parameters in your request:
guidance_method_X
: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1guidance_method_X_scale
: Set the impact of the guidance (0.0 to 1.0)guidance_method_X_image_file
: Provide the base64-encoded input imageBy leveraging these guidance methods, you can achieve more precise control over the generated images, tailoring them to your specific needs and creative vision.
Successful operation.
Bad request.
Forbidden. Insufficient permissions to access the image URL..
Method not allowed.
Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
Unprocessable Entity. The URL does not point to a valid image or is inaccessible.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
Description This endpoint allows the creation of a new dataset that will belong to the organization associated with the used API token. The dataset will be created with a default status of "draft".
Dataset successfully created.
Bad request.
Unauthorized.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "use_case": "illustrative_style",
- "style_description": "A 2d vibrant and colorful flat illustration.",
- "name": "My Illustrations",
- "status": "draft",
- "images_count": 0,
- "images": [ ],
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}
Description Retrieve a list of datasets that belong to the organization associated with the used API token. If no datasets are found, an empty array is returned.
Successful operation.
Unauthorized.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
[- {
- "id": 123,
- "use_case": "illustrative_style",
- "style_description": "A 2d vibrant and colorful flat illustration.",
- "name": "My Illustrations",
- "images_count": 10,
- "status": "completed",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}, - {
- "id": 124,
- "use_case": "illustrative_single_object",
- "style_description": "A 2d illustration of a bear",
- "name": "Character bear",
- "images_count": 5,
- "status": "draft",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}
]
Description Retrieve a specific dataset by its ID. The response includes all the details of the dataset and an array of associated images.
Successful operation.
Unauthorized.
Dataset with the specified ID does not exist.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "use_case": "illustrative_style",
- "style_description": "A 2d vibrant and colorful flat illustration.",
- "name": "My Illustrations",
- "status": "draft",
- "images": [
- {
- "id": 123,
- "name": "Illustration1",
- "caption": "A vibrant 2D illustration of a sunny day with children playing in a park.",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}, - {
- "id": 124,
- "name": "Illustration2",
- "caption": "A colorful 2D illustration depicting a busy city street with various shops and people.",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}
], - "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}
Description
Update the details of a specific dataset by its ID. If the status of the dataset is completed
, the style_description
and use_case
cannot be updated. Additionally, if the status is completed
, it cannot be returned to draft
if a model has already been trained based on it.
Successful operation.
Bad request.
Unauthorized.
Dataset with the specified ID does not exist.
Conflict.
Internal server error.
{- "id": 123,
- "use_case": "illustrative_style",
- "style_description": "A 2d vibrant and colorful flat illustration.",
- "name": "My Illustrations",
- "status": "draft",
- "images": [
- {
- "id": 123,
- "name": "Illustration1",
- "caption": "A vibrant 2D illustration of a sunny day with children playing in a park.",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}, - {
- "id": 124,
- "name": "Illustration2",
- "caption": "A colorful 2D illustration depicting a busy city street with various shops and people.",
- "created_at": "2024-05-26T12:00:00Z",
- "updated_at": null
}
], - "created_at": "2024-05-26T12:00:00Z",
- "updated_at": "2024-05-26T12:00:00Z"
}
Description Delete a specific dataset. Changes status to deleted.
Dataset successfully deleted.
Dataset with the specified ID does not exist.
Conflict.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "error": "Cannot delete a dataset that is used by a model that is in training or has the status 'ready'."
}
Description
Upload a new image to a specific dataset. One of the following parameters, file
or image_url
, must be provided.
Upload a new image using the image file
In our documentation request example, we demonstrate how to upload a new image using the image URL.
If you want to use an image from a file, follow the example below:
import requests
url = "/tailored-gen/datasets/{dataset_id}/images"
payload = {}
files=[
('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))
]
headers = {
'api_token': 'xxxx'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Image successfully uploaded.
Bad request.
Dataset with the specified ID does not exist.
Conflict.
Precondition Failed.
Unsupported Media Type.
Unprocessable Entity.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
id=123&dataset_id=123&caption=A%20vibrant%202D%20illustration%20of%20a%20sunny%20day%20with%20children%20playing%20in%20a%20park.&file_name=Illustration1.png&image_url=https%3A%2F%2Fexample.com%2Fimage1.png&thumbnail_url=https%3A%2F%2Fexample.com%2Fimage1_thumbnail.png&created_at=2024-05-26T12%3A00%3A00Z
Description Retrieve a list of images in a specific dataset.
Successful operation.
Dataset with the specified ID does not exist.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
[- {
- "id": 123,
- "dataset_id": 123,
- "caption": "A vibrant 2D illustration of a sunny day with children playing in a park.",
- "file_name": "Illustration1.png",
- "created_at": "2024-05-26T12:00:00Z"
}, - {
- "id": 123,
- "dataset_id": 123,
- "caption": "A colorful 2D illustration depicting a busy city street with various shops and people.",
- "file_name": "Illustration2.png",
- "created_at": "2024-05-26T12:00:00Z"
}
]
Description Retrieve a specific image by its ID.
Successful operation.
Not Found.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "dataset_id": 123,
- "caption": "A vibrant 2D illustration of a sunny day with children playing in a park.",
- "file_name": "Illustration1.png",
- "created_at": "2024-05-26T12:00:00Z"
}
Description Delete a specific image.
Image successfully deleted.
Not Found.
Conflict.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "error": "Image with the specified ID does not exist."
}
Description Create a new model.
Model successfully created.
Dataset with the specified ID does not exist.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "name": "My Model",
- "description": "This model is designed for generating illustrative style images.",
- "status": "Created",
- "dataset_id": 123,
- "created_at": "2024-05-26T12:00:00Z"
}
Description Retrieve a list of models. If there are no models, an empty array is being returned.
Successful operation.
Unauthorized.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
[- {
- "id": 123,
- "name": "My Model",
- "description": "This model is designed for generating illustrative style images.",
- "status": "Created",
- "dataset_id": 123,
- "created_at": "2024-05-26T12:00:00Z"
}, - {
- "id": 124,
- "name": "Another Model",
- "description": "This model is designed for generating character style images.",
- "status": "Training In Progress",
- "dataset_id": 124,
- "created_at": "2024-05-26T12:00:00Z"
}
]
Description Retrieve a specific model by its ID.
Successful operation.
Model with the specified ID does not exist.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "name": "My Model",
- "description": "This model is designed for generating illustrative style images.",
- "status": "Created",
- "dataset_id": 123,
- "created_at": "2024-05-26T12:00:00Z"
}
Description Delete a specific model.
Model successfully deleted.
Model with the specified ID does not exist.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "status": "Deleted"
}
Description Start a new training job for a specific model. Training of a tailored model takes between 1-3 hours.
Training job successfully started.
Model with the specified ID does not exist.
Conflict.
Precondition Failed.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "id": 123,
- "status": "Training In Progress"
}
Description Stop a specific training job for a model.
Training job successfully stopped.
Model with the specified ID does not exist.
Conflict.
Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
Internal server error.
{- "error": "Model with the specified ID does not exist."
}