Skip to main content

Enterprise: Fashion Endpoint

Overview

This endpoint allows you to wear a cloth image sample on an existing model body. The ideal input images should have white background, fully visible model body, and the cloth should be an individual piece.

Fashion endpoint result
caution

Make sure you add your s3 details for video server, so you can receive image generated in your bucket. Images generated without s3 details being added will be delete after 24 hours

Request

--request POST 'https://modelslab.com/api/v1/enterprise/image_editing/fashion' \

Make a POST request to https://modelslab.com/api/v1/enterprise/image_editing/fashion endpoint and pass the required parameters as a request body to the endpoint.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
init_imageImage URL of the model to try the dress on
cloth_imageCloth/Dress URL for the garment to try-on
cloth_typeOne of upper_body, lower_body or dresses based on where the garment is to be worn
promptText prompt with description of the things you want in the image to be generated
negative_promptItems you don't want in the image
num_inference_stepsNumber of denoising steps. Value accepted are 21,31 or 41.
temp"yes" if you want proxy links to access images apart from normal links. Useful in case your country blocks our storage provider. Default: "no"
guidance_scaleScale for classifier-free guidance (minimum: 1; maximum: 20)
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key": "",
"prompt": ":A realistic photo of a model wearing a beautiful t-shirt",
"negative_prompt": "Low quality, unrealistic, bad cloth, warped cloth",
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5dzoZ9qWI2FQxwceFDb3zULRtwCRmF-metaZjA5NjMyX3BhcmVudF8xXzE2NTMwMDMzODguanBn-.jpg",
"cloth_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5BDmwvtizESFRO24uGDW1iu1u5TXhB-metaM2JmZmFkY2U5NDNkOGU3MDJhZDE0YTk2OTY2NjQ0NjYuanBn-.jpg",
"cloth_type": "upper_body",
"guidance_scale": 7.5,
"num_inference_steps": 21,
"seed": null,
"temp": "no",
"webhook": null,
"track_id": null
}

Request

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

var raw = JSON.stringify({
"key": "",
"prompt": "A realistic photo of a model wearing a beautiful t-shirt",
"negative_prompt": "Low quality, unrealistic, bad cloth, warped cloth",
"init_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5dzoZ9qWI2FQxwceFDb3zULRtwCRmF-metaZjA5NjMyX3BhcmVudF8xXzE2NTMwMDMzODguanBn-.jpg",
"cloth_image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5BDmwvtizESFRO24uGDW1iu1u5TXhB-metaM2JmZmFkY2U5NDNkOGU3MDJhZDE0YTk2OTY2NjQ0NjYuanBn-.jpg",
"cloth_type": "upper_body",
"guidance_scale": 7.5,
"num_inference_steps": 21,
"seed": null,
"temp": "no",
"webhook": null,
"track_id": null
});

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

fetch("https://modelslab.com/api/v1/enterprise/image_editing/fashion", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

Example Response

{
{
"status": "success",
"generationTime": 3.13963508605957,
"id": 13204,
"output": [],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/284c4f3d-4bf6-4bad-a603-d2a1948de0cf.png"
],
"meta": {
"base64": "no",
"cloth": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5BDmwvtizESFRO24uGDW1iu1u5TXhB-metaM2JmZmFkY2U5NDNkOGU3MDJhZDE0YTk2OTY2NjQ0NjYuanBn-.jpg",
"cloth_type": "upper_body",
"file_prefix": "284c4f3d-4bf6-4bad-a603-d2a1948de0cf",
"guidance_scale": 7.5,
"image": "https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/livewire-tmp/5dzoZ9qWI2FQxwceFDb3zULRtwCRmF-metaZjA5NjMyX3BhcmVudF8xXzE2NTMwMDMzODguanBn-.jpg",
"negative_prompt": "low quality",
"num_inference_steps": 20,
"num_samples": 1,
"outdir": "out",
"prompt": ":A realistic photo of a model wearing a beautiful t-shirt",
"refine_face": "yes",
"scale": 5,
"seed": 70128919,
"temp": "no",
}
}
}