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
47
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/illusion-diffusion-hq";
const reqBody = {
"seed": -1,
"image": "https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png",
"width": 768,
"border": 1,
"height": 768,
"prompt": "(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance",
"num_outputs": 1,
"guidance_scale": 7.5,
"negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
"qrcode_background": "gray",
"num_inference_steps": 40,
"controlnet_conditioning_scale": 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);
}
})();
Seed
Input image. If none is provided, a QR code will be generated
Width out the output image
QR code border size
min : 0,
max : 4
Height out the output image
The prompt to guide QR Code generation.
Number of outputs
min : 1,
max : 4
Scale for classifier-free guidance
min : 0.1,
max : 30
The negative prompt to guide image generation.
The website/content your QR Code will point to.
An enumeration.
Allowed values:
Number of diffusion steps
min : 20,
max : 100
The outputs of the controlnet are multiplied by `controlnet_conditioning_scale` before they are added to the residual in the original unet.
min : 0,
max : 4
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.
Illusion Diffusion is an innovative application that uses Stable Diffusion and Controlnet AI models to transform ordinary images into optical illusions and surreal artworks.
Users can upload photos, enter text prompts, and adjust parameters to customize the effect and style of their creations. The result is stunning high-quality illusion artwork. This tool opens up a new realm of possibilities for digital art, allowing users to create unique and captivating images with ease.