Model Swap

These APIs can be used to generate catalogs. You can upload images of humans and mannequins wearing garments and can swap them with customized Fashion Models and Backgrounds based on prompts.

Mannequin to Fashion Model

Human to Fashion Model

Upload Image

post

API to upload Mannequin/Human Image for to replace with Fashion Model and Custom Background.

Authorizations
Body
imagestring · binaryOptional

all image file types are supported

typestringOptional

this will be always model for cataloging

Example: model
genderstringOptional

male or female

Example: male
preprocessstringOptional

if you want to use this image just for cataloging(and not for virtual try-on) set preprocess false

Example: false
accessstringOptional

private or public

Example: private
Responses
200
Successful response
application/json
post
POST /api/v1/experiment_image/ HTTP/1.1
Host: prod.server.tryonlabs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 89

{
  "image": "binary",
  "type": "model",
  "gender": "male",
  "preprocess": "false",
  "access": "private"
}
200

Successful response

{
  "id": "xxxxxxxxxx",
  "image_url": "api/v1/ei/6307170380/d?token=xxxxx-xxxxx-xxxxx-xxxxx",
  "created_on": "2024-08-29T00:12:07.228977Z",
  "image": "/media/uploaded_images/xxxx.png",
  "type": "model",
  "gender": "male",
  "model_type": "null",
  "garment_type": "null",
  "garment_brand": "Unknown",
  "file_url": "null",
  "access": "private",
  "shopify_product_id": "null",
  "shopify_product_handle": "null",
  "images_dir": "6307170380",
  "token": "xxxxx-xxxxx-xxxxx-xxxxx",
  "token_expiry": "2024-08-30T00:12:07.238254Z",
  "preprocessing": "pending",
  "user": "7476083494"
}

Get Status of Uploaded Image

get

API to get the status of uploaded image, if uploaded, in response preprocessing key will have the value completed

Authorizations
Path parameters
idstringRequired

ID of uploaded image

Responses
200
Successful response
application/json
get
GET /api/v1/experiment_image/{id}/ HTTP/1.1
Host: prod.server.tryonlabs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": "xxxxxxxxxx",
  "image_url": "api/v1/ei/6307170380/d?token=xxxxx-xxxxx-xxxxx-xxxxx",
  "created_on": "2024-08-29T00:12:07.228977Z",
  "image": "/media/uploaded_images/xxxx.png",
  "type": "model",
  "gender": "male",
  "model_type": "null",
  "garment_type": "null",
  "garment_brand": "Unknown",
  "file_url": "null",
  "access": "private",
  "shopify_product_id": "null",
  "shopify_product_handle": "null",
  "images_dir": "6307170380",
  "token": "xxxxx-xxxxx-xxxxx-xxxxx",
  "token_expiry": "2024-08-30T00:12:07.238254Z",
  "preprocessing": "completed",
  "user": "7476083494"
}

Start the Model/Mannequin Swap

post

API to start the Mannequin/Model Swap using previously uploaded Image IDs. Provide appropriate prompt to customize Output Image

Authorizations
Body
model_idstringOptional

ID you get after uploading mannequin/human image

Example: xxxxxxxxxx
paramsstringOptional

Prompts for Fashion Model and Background and other tuning factors

Example: {'prompt': 'RAW photo, hyper-realistic image of a female of asian ethnicity, looking at camera, straight hair, 19 years age, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3', 'guidance_scale': 10.0, 'strength': 0.8, 'num_inference_steps': 30, 'seed':-1, 'garment_class': 'upper garment', 'negative_prompt': '(hands:1.15), disfigured, ugly, bad, immature, cartoon, anime, 3d, painting, b&w, (ugly), (pixelated), watermark, glossy, smooth'}
actionstringOptional

name of AI model to be used, for current use case use model_swap

Example: model_swap
Responses
200
Successful response
post
POST /api/v1/experiment/ HTTP/1.1
Host: prod.server.tryonlabs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 517

{
  "model_id": "xxxxxxxxxx",
  "params": "{'prompt': 'RAW photo, hyper-realistic image of a female of asian ethnicity, looking at camera, straight hair, 19 years age, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3', 'guidance_scale': 10.0, 'strength': 0.8, 'num_inference_steps': 30, 'seed':-1, 'garment_class': 'upper garment', 'negative_prompt': '(hands:1.15), disfigured, ugly, bad, immature, cartoon, anime, 3d, painting, b&w, (ugly), (pixelated), watermark, glossy, smooth'}",
  "action": "model_swap"
}

No content

Get Status of Model Swap

get

API to get status of Model Swapping(Takes about 25 Seconds)

Authorizations
Path parameters
idstringRequired

ID of Cataloging image

Responses
200
Successful response
get
GET /api/v1/experiment/{id}/ HTTP/1.1
Host: prod.server.tryonlabs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Download the Swapped Image

get

API to Download Images

Authorizations
Path parameters
idstringRequired

ID of image to be downloaded

tokenstringRequired

Image Token from Uplaoded/Model Swapped Image

Responses
200
Successful response
application/json
get
GET /api/v1/ei/{id}/d HTTP/1.1
Host: prod.server.tryonlabs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": "binary"
}

Last updated