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
import requests
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/style-transfer"
# Prepare data and files
data = {}
files = {}
data['seed'] = None
data['model'] = "fast"
data['width'] = 1024
data['height'] = 1024
data['prompt'] = "A panda running on a jogging track"
# For parameter "style_image", you can send a raw file or a URI:
# files['style_image'] = open('IMAGE_PATH', 'rb') # To send a file
# data['style_image'] = 'IMAGE_URI' # To send a URI
data['output_format'] = "webp"
data['output_quality'] = 80
data['negative_prompt'] = ""
# For parameter "structure_image", you can send a raw file or a URI:
# files['structure_image'] = open('IMAGE_PATH', 'rb') # To send a file
# data['structure_image'] = 'IMAGE_URI' # To send a URI
data['number_of_images'] = 1
data['structure_depth_strength'] = 1
data['structure_denoising_strength'] = 0.65
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
Set a seed for reproducibility. Random by default.
An enumeration.
Allowed values:
Width of the output image (ignored if structure image given)
Height of the output image (ignored if structure image given)
Prompt for the image
Copy the style from this image
An enumeration.
Allowed values:
Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
min : 0,
max : 100
Things you do not want to see in your image
An optional image to copy structure from. Output images will use the same aspect ratio.
Number of images to generate
min : 1,
max : 10
Strength of the depth controlnet
min : 0,
max : 2
How much of the original image (and colors) to preserve (0 is all, 1 is none, 0.65 is a good balance)
min : 0,
max : 1
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.
IPAdapter with Style Transfer revolutionizes image editing by seamlessly combining the functionality of IPAdapter with advanced style transfer techniques. This approach enables users to effortlessly apply artistic styles to their images while preserving the original content. Whether you want to transform a photo into a painting or give it a unique artistic flair, IPAdapter with Style Transfer provides the tools to make your creative vision a reality. The result is a blend of sophisticated technology and artistic expression, allowing for stunning visual transformations.