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-depth"
# Request payload
data = {
"prompt": "living room",
"negative_prompt": "lowquality, badquality, sketches",
"samples": 1,
"scheduler": "Euler a",
"num_inference_steps": 25,
"guidance_scale": 7,
"seed": 56433128,
"controlnet_scale": 1,
"ip_adapter_scale": 0.7,
"strength": 1,
"base64": False,
"input_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/outputs/depth_img_input.jpg"), # Or use image_file_to_base64("IMAGE_PATH")
"ip_image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/outputs/depth_ip_input.jpg") # 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
Prompt to render
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
Number of samples to generate.
min : 1,
max : 4
Type of scheduler.
Allowed values:
Number of denoising steps.
min : 20,
max : 100
Scale for classifier-free guidance
min : 1,
max : 25
Seed for image generation.
min : -1,
max : 999999999999999
Scale for classifier-free guidance
min : 0,
max : 1
Scale for classifier-free guidance
min : 0,
max : 1
Scale for classifier-free guidance
min : 0,
max : 1
Base64 encoding of the output image.
Input Image
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 Depth XL is a groundbreaking AI model that revolutionizes the way we approach image generation. By integrating the IP Adapter with the Depth Preprocessor, this model significantly enhances the functionality of the SDXL framework, offering a unique blend of depth perception and contextual understanding in image creation.
At the core of IP Adapter Depth XL is the innovative combination of two powerful tools. The IP Adapter allows the SDXL model to effectively utilize image prompts alongside text prompts, while the Depth Preprocessor analyzes and extracts depth cues from images. This synergy results in a model that not only generates detailed images but also understands and replicates the spatial dimensions of the original scene.
Dual Prompt Integration : Seamlessly combines image and text prompts for intricate image transformations.
Advanced Depth Perception:Utilizes the Depth Preprocessor to extract and interpret depth cues, adding a new dimension to images.
Contextual Depth and Detail: Produces images that are not only detailed but also rich in contextual depth.
Creative Versatility: Ideal for a wide range of applications, from digital art to scientific visualization.
Digital Art and Illustration: Create complex artworks that blend elements from different images and concepts.
Architectural Visualization: Enhance architectural renderings with accurate depth perception and detailed textures.
Photography Enhancement: Combine photographic elements with artistic prompts for unique compositions.
Educational Tools: Teach advanced concepts in digital art and image processing.
Personal Projects: Experiment with blending personal photos with creative text prompts for unique creations.