If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/try-on-diffusion"
# Request payload
data = {
"model_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/display_images/model.png"), # Or use image_file_to_base64("IMAGE_PATH")
"cloth_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/display_images/cloth.jpg"), # Or use image_file_to_base64("IMAGE_PATH")
"category": "Upper body",
"num_inference_steps": 35,
"guidance_scale": 2,
"seed": 12467,
"base64": False
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Input Image.
Cloth Image
What type of clothes
Allowed values:
Number of denoising steps.
min : 20,
max : 100
Scale for classifier-free guidance
min : 1,
max : 25
Seed for image generation.
min : -1,
max : 999999999999999
Base64 encoding of the output image.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
TryOnDiffusion, a virtual try-on AI technique can realistically superimpose clothing onto a person's image despite variations in body shape and pose. By warping the garment image and blending it seamlessly with the person's image. It is designed to address two challenges in virtual try-on. One is preserving the garment or clothing details and the other one is adapting to body pose and shape changes.
TryOnDiffusion uses a system called Parallel-UNet. The parallel-Unet has two parts: Person-UNet and Garment-UNet.
Person-UNet analyzes a picture of a person with some added noise to capture detail.
Garment-UNet focuses on the image of the clothing that needs be to overlayed on the person.
To make the clothes fit perfectly, TryOnDiffusion uses a technique called "implicit warping." This lets the garment-UNet adjust the clothing's shape on the fly, while the person-UNet seamlessly blends it onto the person's image. This two-UNet teamwork with implicit warping is what allows TryOnDiffusion to create such realistic virtual try-on experiences.
Input image: Provide an image of a person.
Cloth Image: Upload a clothing image, preferably with a white or transparent background. Ensure the image contains only the clothing piece.
a. Upper body: This involves overlaying clothing items such as t-shirts, tank tops, shirts, jackets, etc.,
b. Lower body: This involves overlaying lower body clothing items like pants, trousers, skirts, shorts, etc
c. Full Body: It involves overlaying a complete dress on a person's image.
Try-on Diffusion is used in many virtual try-on workflows in Pixelflow. It is ideal for virtual try-on use cases in the e-commerce industry. Some of the workflows that utilize Try-On Diffusion include:
Full body virtual try-on: Superimposes any clothing (upper, lower and full body) onto a person’s image.
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers
Story Diffusion turns your written narratives into stunning image sequences.
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software