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
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/consistent-character-with-pose";
const data = {
"base_64": false,
"custom_height": 1024,
"custom_width": 1024,
"face_image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/ccpose_ip.png')",
"output_format": "png",
"pose_image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/cc_pose_img.png')",
"prompt": "A candid photo of a woman , wearing a blue denim shirt and matching jeans. light smile on her face",
"quality": 95,
"samples": 1,
"seed": 2778725438,
"use_input_img_dimension": true
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
Output as base64 encoded string
Custom height for output image
min : 64,
max : 4096
Custom width for output image
min : 64,
max : 4096
Face image
Output image format
Allowed values:
Pose image
Textual description for the image generation
Image quality setting for output
min : 10,
max : 100
Number of images to generate
min : 1,
max : 4
Random seed for generation
Whether to use the input image's dimensions
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.
Consistent Character lets you generate new images of a specific person with remarkable consistency. It takes just one reference image and a text description of the desired pose variations. The magic lies in its ability to seamlessly transfer the person's unique characteristics onto a new body in a different pose. Under the hood of Consistent Character model is a combination of IP Adapter Face and instant id and openpose controlnet for generating image with pose followed by upscaling.