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 30 31 32 33 34 35 36 37 38 39 import requests import base64 # Use this function to convert an image file from the filesystem to base64 def image_file_to_base64(image_path): with open(image_path, 'rb') as f: image_data = f.read() return base64.b64encode(image_data).decode('utf-8') # Use this function to fetch an image from a URL and convert it to base64 def image_url_to_base64(image_url): response = requests.get(image_url) image_data = response.content return base64.b64encode(image_data).decode('utf-8') api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/ip-sdxl-canny" # Request payload data = { "prompt": "woman sculpture", "negative_prompt": "lowquality, badquality, sketches", "samples": 1, "scheduler": "Euler a", "num_inference_steps": 25, "guidance_scale": 7, "seed": 354849415, "controlnet_scale": 0.8, "ip_adapter_scale": 0.5, "strength": 0.9, "base64": False, "input_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/outputs/canny_img_input.jpeg"), # Or use image_file_to_base64("IMAGE_PATH") "ip_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/outputs/canny_ip_input.png") # Or use image_file_to_base64("IMAGE_PATH") } headers = {'x-api-key': api_key} response = requests.post(url, json=data, 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


promptstr *

Prompt to render


negative_promptstr ( default: None )

Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'


samplesint ( default: 1 ) Affects Pricing

Number of samples to generate.

min : 1,

max : 4


schedulerenum:str ( default: DPM2 Karras )

Type of scheduler.

Allowed values:


num_inference_stepsint ( default: 25 ) Affects Pricing

Number of denoising steps.

min : 20,

max : 100


guidance_scalefloat ( default: 7.5 )

Scale for classifier-free guidance

min : 1,

max : 25


seedint ( default: -1 )

Seed for image generation.

min : -1,

max : 999999999999999


controlnet_scalefloat ( default: 7.5 )

Scale for classifier-free guidance

min : 0,

max : 1


ip_adapter_scalefloat ( default: 7.5 )

Scale for classifier-free guidance

min : 0,

max : 1


strengthfloat ( default: 0.99 )

Scale for classifier-free guidance

min : 0,

max : 1


base64boolean ( default: 1 )

Base64 encoding of the output image.


input_imageimage *

Input Image


ip_imageimage *

Ip Image

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.

IP Adapter Canny XL

IP Adapter Canny XL represents a significant advancement in the field of AI-driven image transformation. Built on the SDXL framework, this model integrates the IP Adapter and Canny edge preprocessor to offer unparalleled control and guidance in creating context-rich images. It's an ideal solution for artists, designers, and anyone looking to combine the precision of text prompts with the creativity of image prompts.

The IP Adapter Canny XL model stands out with its unique ability to utilize both image and text prompts. The IP Adapter processes the image prompt, blending it with features from the text prompt to create a modified image. This image is further refined using preprocessors like Canny, which extracts outlines from the input image, retaining the composition of the original while infusing new elements.

Key Features:

  1. Dual Prompt Integration : Seamlessly combines image and text prompts for intricate image transformations.

  2. Canny Edge Preprocessor: Enhances image outlines, maintaining the original composition's integrity.

  3. Context-Rich Outputs: Produces images that skillfully merge aspects of both the input and the image prompt.

  4. Creative Versatility: Offers a wide range of possibilities for artistic and design projects.

Applications:

  1. Digital Art and Illustration: Create complex artworks that blend elements from different images and concepts.

  2. Graphic Design: Enhance design projects with unique, context-rich visuals.

  3. Photography Enhancement: Combine photographic elements with artistic prompts for unique compositions.

  4. Educational Tools: Teach advanced concepts in digital art and image processing.

  5. Personal Projects: Experiment with blending personal photos with creative text prompts for unique creations.