POST
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
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


seedint ( default: -1 )

Seed


imagestr ( default: https://segmind-sd-models.s3.amazonaws.com/display_images/spiral.png )

Input image. If none is provided, a QR code will be generated


widthint ( default: 768 )

Width out the output image


borderint ( default: 1 )

QR code border size

min : 0,

max : 4


heightint ( default: 768 )

Height out the output image


promptstr *

The prompt to guide QR Code generation.


num_outputsint ( default: 1 )

Number of outputs

min : 1,

max : 4


guidance_scalefloat ( default: 7.5 )

Scale for classifier-free guidance

min : 0.1,

max : 30


negative_promptstr ( default: ugly, disfigured, low quality, blurry, nsfw )

The negative prompt to guide image generation.


qr_code_contentstr ( default: 1 )

The website/content your QR Code will point to.


qrcode_backgroundenum:str ( default: gray )

An enumeration.

Allowed values:


num_inference_stepsint ( default: 40 )

Number of diffusion steps

min : 20,

max : 100


controlnet_conditioning_scalefloat ( default: 1 )

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

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.