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 32 33 34 35 36 37 38 39 40 import requests api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/omni-zero" # Prepare data and files data = {} files = {} data['seed'] = 42 data['prompt'] = "A person" # For parameter "base_image", you can send a raw file or a URI: # files['base_image'] = open('IMAGE_PATH', 'rb') # To send a file # data['base_image'] = 'IMAGE_URI' # To send a URI # 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['guidance_scale'] = 3 # For parameter "identity_image", you can send a raw file or a URI: # files['identity_image'] = open('IMAGE_PATH', 'rb') # To send a file # data['identity_image'] = 'IMAGE_URI' # To send a URI data['negative_prompt'] = "blurry, out of focus" data['number_of_steps'] = 10 data['number_of_images'] = 1 # For parameter "composition_image", you can send a raw file or a URI: # files['composition_image'] = open('IMAGE_PATH', 'rb') # To send a file # data['composition_image'] = 'IMAGE_URI' # To send a URI # For parameter "depth_image", you can send a raw file or a URI: # files['depth_image'] = open('IMAGE_PATH', 'rb') # To send a file # data['depth_image'] = 'IMAGE_URI' # To send a URI data['base_image_strength'] = 0.15 data['depth_image_strength'] = 0.5 data['style_image_strength'] = 1 data['identity_image_strength'] = 1 data['composition_image_strength'] = 1 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: 42 )

Random seed for the model


promptstr ( default: A person )

Prompt for the model


base_imagestr ( default: https://segmind-sd-models.s3.amazonaws.com/display_images/omni-zero-base.jpg )

Base image for the model


style_imagestr *

Style image for the model


guidance_scalefloat ( default: 3 )

Guidance scale for the model

min : 0,

max : 14


identity_imagestr *

Identity image for the model


negative_promptstr ( default: blurry, out of focus )

Negative prompt for the model


number_of_stepsint ( default: 10 )

Number of steps for the model

min : 1,

max : 50


number_of_imagesint ( default: 1 )

Number of images to generate

min : 1,

max : 4


composition_imagestr ( default: https://segmind-sd-models.s3.amazonaws.com/display_images/omni-zero-base.jpg )

Composition image for the model


depth_imagestr ( default: 1 )

Depth image for the model


base_image_strengthfloat ( default: 0.15 )

Base image strength for the model

min : 0,

max : 1


depth_image_strengthfloat ( default: 0.5 )

Depth image strength for the model, if not supplied the composition image will be used for depth

min : 0,

max : 1


style_image_strengthfloat ( default: 1 )

Style image strength for the model

min : 0,

max : 1


identity_image_strengthfloat ( default: 1 )

Identity image strength for the model

min : 0,

max : 1


composition_image_strengthfloat ( default: 1 )

Composition image strength for the model

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.

Omni Zero

Omni Zero is a powerful tool designed to create stylized portraits with zero-shot learning. Combining composition, style and identity images, Omni Zero can transform ordinary images into captivating artworks. Here are the key features:

  • Zero-Shot Composition: Omni Zero requires just one image to set the structure and the scene of the output image and does not require any training at all.

  • Zero-Shot Stylization: Omni Zero requires no training data or specific style examples. It adapts to any input image, making it ideal for artists, designers, and photographers.

  • Single Identity and Style: Omni Zero seamlessly integrates identity and style, allowing you to maintain the subject’s likeness while adding artistic flair to the image.

  • Multiple Identities and Styles (Work in Progress): Future updates will enable multi-identity and multi-style transformations, expanding creative possibilities.