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
import requests
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/illusion-diffusion-hq"
# Prepare data and files
data = {}
files = {}
data['seed'] = -1
# For parameter "image", you can send a raw file or a URI:
# files['image'] = open('IMAGE_PATH', 'rb') # To send a file
# data['image'] = 'IMAGE_URI' # To send a URI
data['width'] = 768
data['border'] = 1
data['height'] = 768
data['prompt'] = "(masterpiece:1.4), (best quality), (detailed), Medieval village scene with busy streets and castle in the distance"
data['num_outputs'] = 1
data['guidance_scale'] = 7.5
data['negative_prompt'] = "ugly, disfigured, low quality, blurry, nsfw"
data['qr_code_content'] = ""
data['qrcode_background'] = "gray"
data['num_inference_steps'] = 40
data['controlnet_conditioning_scale'] = 1
headers = {'x-api-key': api_key}
response = requests.post(url, data=data, files=files, headers=headers)
print(response.content) # The response is the generated image
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.