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 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
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


seedint ( default: 1 )

Set a seed for reproducibility. Random by default.


modelenum:str ( default: fast )

An enumeration.

Allowed values:


widthint ( default: 1024 )

Width of the output image (ignored if structure image given)


heightint ( default: 1024 )

Height of the output image (ignored if structure image given)


promptstr ( default: A panda running on a jogging track )

Prompt for the image


style_imagestr *

Copy the style from this image


output_formatenum:str ( default: webp )

An enumeration.

Allowed values:


output_qualityint ( default: 80 )

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.

min : 0,

max : 100


negative_promptstr ( default: 1 )

Things you do not want to see in your image


structure_imagestr ( default: 1 )

An optional image to copy structure from. Output images will use the same aspect ratio.


number_of_imagesint ( default: 1 )

Number of images to generate

min : 1,

max : 10


structure_depth_strengthfloat ( default: 1 )

Strength of the depth controlnet

min : 0,

max : 2


structure_denoising_strengthfloat ( default: 0.65 )

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.

Style Transfer

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.

Know more about IPAdapter Style Transfer here.