Profile Photo Style Transfer
Turn any image of a face into artwork using Stable Diffusion Controlnet and IPAdapter
1import requests
2import json
3
4url = "https://api.segmind.com/v1/become-image"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-inference-io.s3.us-east-1.amazonaws.com/sample_images/image_71.webp",
12 "prompt": "a person",
13 "image_to_become": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
14 "prompt_strength": 2,
15 "number_of_images": 2,
16 "denoising_strength": 1,
17 "instant_id_strength": 1,
18 "image_to_become_noise": 0.3,
19 "control_depth_strength": 0.8,
20 "disable_safety_checker": true,
21 "image_to_become_strength": 0.75
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/become-image"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-inference-io.s3.us-east-1.amazonaws.com/sample_images/image_71.webp",
12 "prompt": "a person",
13 "image_to_become": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
14 "prompt_strength": 2,
15 "number_of_images": 2,
16 "denoising_strength": 1,
17 "instant_id_strength": 1,
18 "image_to_become_noise": 0.3,
19 "control_depth_strength": 0.8,
20 "disable_safety_checker": true,
21 "image_to_become_strength": 0.75
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text)API Endpoint
https://api.segmind.com/v1/become-imageParameters
control_depth_strengthoptionalnumberStrength of depth controlnet. The bigger this is, the more controlnet affects the output.
0.8Range: 0 - 1denoising_strengthoptionalnumberHow much of the original image of the person to keep. 1 is the complete destruction of the original image, 0 is the original image
1Range: 0 - 1disable_safety_checkeroptionalbooleanDisable safety checker for generated images
trueimageoptionalstring (uri)An image of a person to be converted
"https://segmind-inference-io.s3.us-east-1.amazonaws.com/sample_images/image_71.webp"image_to_becomeoptionalstring (uri)Any image to convert the person to
"https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp"image_to_become_noiseoptionalnumberHow much noise to add to the style image before processing. An alternative way of controlling stength.
0.3Range: 0 - 1image_to_become_strengthoptionalnumberHow strong the style will be applied
0.75Range: 0 - 1instant_id_strengthoptionalnumberHow strong the InstantID will be.
1Range: 0 - 1negative_promptoptionalstringThings you do not want in the image
""number_of_imagesoptionalintegerNumber of images to generate
2Range: 1 - 10promptoptionalstring"a person"prompt_strengthoptionalnumberStrength of the prompt. This is the CFG scale, higher numbers lead to stronger prompt, lower numbers will keep more of a likeness to the original.
2Range: 0 - 3seedoptionalintegerFix the random seed for reproducibility
nullResponse 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