Virtual Try On - Upper Body
Generate images by combining clothing and model images using the Fashion Image Generation API. Customize the image generation process with various parameters.
- Python
 - JavaScript
 - PHP
 
import requests
import json
url = "https://api.imagepipeline.io/fashion_upper/v1"
headers = {
    "API-Key": "your-api-key",
    "Content-Type": "application/json"
}
data = {
    "cloth_image": "https://example.com/clothing.jpg",
    "model_image": "https://example.com/model.jpg",
    "num_inference_steps": 30,
    "guidance_scale": 15,
    "samples": 4,
    "server_id": "your-server-id",
    "webhook": "https://example.com/webhook",
    "direct_link": true,
    "batch_id": "batch123",
    "file_prefix": "fashion_",
    "queued_image_urls": true
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const url = "https://api.imagepipeline.io/fashion_upper/v1";
const headers = {
    "API-Key": "your-api-key",
    "Content-Type": "application/json"
};
const data = {
    "cloth_image": "https://example.com/clothing.jpg",
    "model_image": "https://example.com/model.jpg",
    "num_inference_steps": 30,
    "guidance_scale": 15,
    "samples": 4,
    "server_id": "your-server-id",
    "webhook": "https://example.com/webhook",
    "direct_link": true,
    "batch_id": "batch123",
    "file_prefix": "fashion_",
    "queued_image_urls": true
};
fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/fashion_upper/v1";
$headers = array(
    "API-Key: your-api-key",
    "Content-Type: application/json"
);
$data = array(
    "cloth_image" => "https://example.com/clothing.jpg",
    "model_image" => "https://example.com/model.jpg",
    "num_inference_steps" => 30,
    "guidance_scale" => 15,
    "samples" => 4,
    "server_id" => "your-server-id",
    "webhook" => "https://example.com/webhook",
    "direct_link" => true,
    "batch_id" => "batch123",
    "file_prefix" => "fashion_",
    "queued_image_urls" => true
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
    die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
Available JSON Parameters for Control
| Parameter | Type | Notes | 
|---|---|---|
cloth_image | string | required. Public URL for the clothing image. | 
model_image | string | required. Public URL for the model image. | 
num_inference_steps | integer | required. Number of inference steps. | 
guidance_scale | number | required. Max: 20. The guidance scale for the image generation. | 
samples | integer | required. Max: 4. Number of image samples to generate. | 
server_id | string | Optional. Provide a server ID for load-balancing or to use an enterprise subscription. | 
webhook | string | URL to send the generated image to. | 
direct_link | boolean | Fetches the friendly URL in PNG format. | 
batch_id | string | Adds a batch ID for the image generation request. | 
file_prefix | string | Adds a prefix to the generated files. | 
queued_image_urls | boolean | Returns the links of the images prematurely. The link will have the image once the task is run successfully. | 
Status
Your response will include a status.
- If the 
status=SUCCESS, you will also havedownload_urlsthat will contain the links to your generated image based on the number of samples you have entered. The maximum number of samples that can be generated is 4. - If the 
status=PENDING, you will receive anid. You can use the status endpoint to fetch your image using theid. - If the 
status=FAILURE, you will receive only an error message. 
Endpoint: [GET]
https://api.imagepipeline.io/fashion_upper/v1/status/{{id}}
Pass the API-Key as the authorization in the header.