AI Product Photo Editor
AI Product Photo Editor leverages advanced image-based ML techniques to generate high-quality product visuals using text prompts, product images, and background images.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ai-product-photo-editor"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "product_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/main-ip.jpeg",
12 "background_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/bg6.png",
13 "prompt": "photo of a mixer grinder in modern kitchen",
14 "negative_prompt": "illustration, bokeh, low resolution, bad anatomy, painting, drawing, cartoon, bad quality, low quality",
15 "num_inference_steps": 21,
16 "guidance_scale": 6,
17 "seed": 2566965,
18 "sampler": "dpmpp_3m_sde_gpu",
19 "scheduler": "karras",
20 "samples": 1,
21 "ipa_weight": 0.3,
22 "ipa_weight_type": "linear",
23 "ipa_start": 0,
24 "ipa_end": 0.5,
25 "ipa_embeds_scaling": "V only",
26 "cn_strenght": 0.85,
27 "cn_start": 0,
28 "cn_end": 0.8,
29 "dilation": 10,
30 "mask_threshold": 220,
31 "gaussblur_radius": 8,
32 "base64": false
33}
34
35response = requests.post(url, headers=headers, json=data)
36
37if response.status_code == 200:
38 result = response.json()
39 print(json.dumps(result, indent=2))
40else:
41 print(f"Error: {response.status_code}")
42 print(response.text)
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ai-product-photo-editor"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "product_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/main-ip.jpeg",
12 "background_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/bg6.png",
13 "prompt": "photo of a mixer grinder in modern kitchen",
14 "negative_prompt": "illustration, bokeh, low resolution, bad anatomy, painting, drawing, cartoon, bad quality, low quality",
15 "num_inference_steps": 21,
16 "guidance_scale": 6,
17 "seed": 2566965,
18 "sampler": "dpmpp_3m_sde_gpu",
19 "scheduler": "karras",
20 "samples": 1,
21 "ipa_weight": 0.3,
22 "ipa_weight_type": "linear",
23 "ipa_start": 0,
24 "ipa_end": 0.5,
25 "ipa_embeds_scaling": "V only",
26 "cn_strenght": 0.85,
27 "cn_start": 0,
28 "cn_end": 0.8,
29 "dilation": 10,
30 "mask_threshold": 220,
31 "gaussblur_radius": 8,
32 "base64": false
33}
34
35response = requests.post(url, headers=headers, json=data)
36
37if response.status_code == 200:
38 result = response.json()
39 print(json.dumps(result, indent=2))
40else:
41 print(f"Error: {response.status_code}")
42 print(response.text)
API Endpoint
https://api.segmind.com/v1/ai-product-photo-editor
Parameters
background_image
requiredstring (uri)
Background Reference Image
"https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/bg6.png"
num_inference_steps
requiredinteger
Number of steps to generate image
21
Range: 20 - 100product_image
requiredstring (uri)
Product Image
"https://segmind-sd-models.s3.amazonaws.com/display_images/ppv3-test/main-ip.jpeg"
prompt
requiredstring
Prompt for image generation
"photo of a mixer grinder in modern kitchen"
sampler
requiredstring
Sampler
"dpmpp_3m_sde_gpu"
"euler"
"euler_pp"
"euler_ancestral"
"euler_ancestral_pp"
"heun"
"heunpp2"
"dpm_2"
"dpm_2_ancestral"
"lms"
"dpm_fast"
+17 morebase64
optionalboolean
Output as base64
false
cn_end
optionalnumber
ControlNet end value
0.8
Range: 0 - 1cn_start
optionalnumber
ControlNet start value
0
Range: 0 - 1cn_strenght
optionalnumber
ControlNet strength
0.85
Range: 0 - 2dilation
optionalinteger
Dilation value
10
Range: -100 - 100gaussblur_radius
optionalinteger
Gaussian blur radius
8
Range: 0 - 20guidance_scale
optionalnumber
Scale for classifier-free guidance
6
Range: 0 - 10ipa_embeds_scaling
optionalstring
IP Adapter embedding scaling
"V only"
"V only"
"K+V"
"K+V w/ C penalty"
"K+mean(V) w/ C penalty"
ipa_end
optionalnumber
IP Adapter end value
0.5
Range: 0 - 1ipa_start
optionalnumber
IP Adapter start value
0
Range: 0 - 1ipa_weight
optionalnumber
IP Adapter weight
0.3
Range: 0 - 2ipa_weight_type
optionalstring
Type of IP Adapter weight
"linear"
"linear"
"ease in"
"ease out"
"ease in-out"
"reverse in-out"
"weak input"
"weak output"
"weak middle"
"strong middle"
"style transfer"
+4 moremask_threshold
optionalinteger
Mask threshold value
220
Range: 0 - 255negative_prompt
optionalstring
Negative prompt
"illustration, bokeh, low resolution, bad anatomy, painting, drawing, cartoon, bad quality, low quality"
samples
optionalinteger
Number of samples to generate
1
scheduler
optionalstring
Scheduler
"karras"
"normal"
"karras"
"exponential"
"sgm_uniform"
"simple"
"ddim_uniform"
seed
optionalinteger
Seed number for image generation
2566965
Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out