SDXL
You can use adapters to fix hands, fingers, faces or any deformaties. One of the most commonly used application of Adaper is to lock face and generate same face in any environments. Other applications include fixing hands, fingers and adding details to a specific image.
To use adapters, you will need to pass three extra parameters - adapter name, ip adapter image and scale of the adapter
Tip
- Use only face as input image instead of the full body while using face adapters.
- Supports only foundation SDXL model right now. Support for SDXL checkpoint is coming soon.
- Python
- JavaScript
- php
import requests
import json
url = "https://api.imagepipeline.io/sdxl/text2image/v1"
headers = {
"API-Key": "Your API Key"
}
data = {
"model_id": "sdxl",
"prompt": "cinematic still woman holding mango juice. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy holding a glass of mango juice,",
"negative_prompt": "error, cropped, worst quality, low quality, duplicate, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck",
"num_inference_steps": 20,
"ip_adapter": ["ip-adapter-plus_sdxl_vit-h"],
"ip_adapter_scale": [0.6],
"ip_adapter_style_images": [], //For multi-ip-adapter
"ip_adapter_image": "https://www.keep-calm-and-eat-ice-cream.com/wp-content/uploads/2022/08/Ice-cream-sundae-hero-11.jpg",
"server_id": "", //For enterprise users only
"samples": 1,
"guidance_scale": 7.5,
"width": 1024,
"height": 1024
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
const url = "https://api.imagepipeline.io/sdxl/text2image/v1";
const headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
};
const data = {
"model_id": "sdxl",
"prompt": "cinematic still woman holding mango juice. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy holding a glass of mango juice,",
"negative_prompt": "error, cropped, worst quality, low quality, duplicate, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck",
"ip_adapter": ["ip-adapter-plus_sdxl_vit-h"],
"ip_adapter_scale": [0.6],
"ip_adapter_style_images": [], //For multi-ip-adapter
"ip_adapter_image": "https://www.keep-calm-and-eat-ice-cream.com/wp-content/uploads/2022/08/Ice-cream-sundae-hero-11.jpg",
"server_id": "", //For enterprise users only
"num_inference_steps": 20,
"samples": 1,
"guidance_scale": 7.5,
"width": 1024,
"height": 1024
};
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/sdxl/text2image/v1";
$headers = array(
"API-Key: Your-API-Key",
"Content-Type: application/json"
);
$data = array(
"model_id" => "sdxl",
"prompt" => "cinematic still woman holding mango juice. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy holding a glass of mango juice,",
"negative_prompt" => "error, cropped, worst quality, low quality, duplicate, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck",
"num_inference_steps" => 20,
"samples" => 1,
"guidance_scale" => 7.5,
"width" => 1024,
"height" => 1024,
"ip_adapter"=> ["ip-adapter-plus_sdxl_vit-h"],
"ip_adapter_scale"=> [0.6],
"ip_adapter_style_images"=> [], //For multi-ip-adapter
"ip_adapter_image"=> "https://www.keep-calm-and-eat-ice-cream.com/wp-content/uploads/2022/08/Ice-cream-sundae-hero-11.jpg",
"server_id"=> "", //For enterprise users only
);
$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);
?>
JSON Parameters
Parameter | Permissible values | Notes |
---|---|---|
model_id | str | only accepts sdxl |
prompt | str, 75 tokens | Check our Prompt Guide for tips |
negative_prompt | str, 75 tokens | Check our Prompt Guide for tips |
num_inference_steps | int, [1-100] | Noise is removed with each step, resulting in a higher-quality image over time. Ideal value 20-30 |
strength | float, [0-1] | Optional denoise strength |
samples | int, [1-4] | Generates a maximum of 4 samples per API call |
guidance_scale | float, [1-20] | Higher guidance scale prioritizes text prompt relevance but sacrifices image quality. Ideal value 7.5-12.5 |
width | int | Width in pixels. Lower than or equal to 1024 for best results |
height | int | Height in pixels. Lower than or equal to 1024 for best results |
ip_adapter | str, array | Model id of adapters to be used. You can add multiple by comma separated values. Allowed values are: ip-adapter_sdxl , ip-adapter_sdxl_vit-h , ip-adapter-plus_sdxl_vit-h , ip-adapter-plus-face_sdxl_vit-h |
ip_adapter_scale | float, array[0-1] | How much adapters should guide the generations. You can add multiple by comma separated values. |
ip_adapter_image | str | Input image to the primary adapter model. Mostly used for face lock |
ip_adapter_style_images | str, array | Images to be used by multi IP-adapters for usecases like style transfer or image mixing |
Status
Your response will include a status
.
- If the
status
=SUCCESS
, you will also havedownload_urls
that will have 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 aid
. 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/sdxl/text2image/v1/status/{{id}}
Pass the API-Key as the authorization in the header.
- Input
- Output
{
"model_id": "sdxl",
"prompt": "cinematic still woman holding mango juice. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope",
"negative_prompt": "error, cropped, worst quality, low quality, duplicate, bad proportions, incomplete subject",
"num_inference_steps": 20,
"samples": 4,
"guidance_scale": 7.5,
"width": 1024,
"height": 1024,
"ip_adapter": ["ip-adapter-plus-face_sdxl_vit-h"],
"ip_adapter_scale": [0.6],
"ip_adapter_image": "https://t4.ftcdn.net/jpg/06/44/30/09/360_F_644300965_7asrChyeknn9fA0GuYrmIUFSBHR5HTpo.jpg"
}
{
"download_urls": [
"https://f005.backblazeb2.com/b2api/v2/b...",
]
}