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
34
35
36
37
38
39
40
41
42
43
44
45
46
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/pulid-base";
const reqBody = {
"seed": 451312,
"width": 1024,
"height": 1024,
"prompt": "anime middle aged professional guy",
"face_image": "https://segmind-sd-models.s3.amazonaws.com/outputs/realvis_xl.jpeg",
"face_style": "high-fidelity",
"output_format": "png",
"output_quality": 80,
"negative_prompt": "None",
"checkpoint_model": "general - dreamshaperXL_alpha2Xl10",
"number_of_images": 1
};
(async function() {
try {
const formData = new FormData();
// Append regular fields
for (const key in reqBody) {
if (reqBody.hasOwnProperty(key)) {
formData.append(key, reqBody[key]);
}
}
// Convert and append images as Base64 if necessary
const response = await axios.post(url, formData, {
headers: {
'x-api-key': api_key,
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
})();
Set a seed for reproducibility. Random by default.
Width of the output image (ignored if structure image given)
Height of the output image (ignored if structure image given)
You might need to include a gender in the prompt to get the desired result
The face image to use for the generation
An enumeration.
Allowed values:
An enumeration.
Allowed values:
Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
min : 0,
max : 100
Things you do not want to see in your image
An enumeration.
Allowed values:
Number of images to generate
min : 1,
max : 10
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.
Pure and Lightning ID customization (PuLID) is a novel tuning-free ID customization method for text-to-image generation. By incorporating a Lightning T2I branch with a standard diffusion one, PuLID introduces both contrastive alignment loss and accurate ID loss, minimizing disruption to the original model and ensuring high ID fidelity.
Experiments show that PuLID achieves superior performance in both ID fidelity and editability. Another attractive property of PuLID is that the image elements (e.g., background, lighting, composition, and style) before and after the ID insertion are kept as consistent as possible.