Create Stunning Couples Portraits with Omni-Zero Cognitive Actions

25 Apr 2025
Create Stunning Couples Portraits with Omni-Zero Cognitive Actions

In today's digital age, creating personalized and visually stunning portraits has never been simpler. With the Omni-Zero Cognitive Actions, developers can leverage powerful image generation technology to produce stylized portraits of couples, even with zero-shot capabilities. This means you can generate unique images without needing extensive training data for specific scenarios. In this post, we will explore how to utilize the Create Stylized Couples Portrait action effectively.

Prerequisites

Before diving into the integration, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON data in your preferred programming language.

For authentication, you'll typically pass the API key in the headers of your requests. This allows you to securely access the Cognitive Actions functionalities.

Cognitive Actions Overview

Create Stylized Couples Portrait

The Create Stylized Couples Portrait action generates a zero-shot stylized portrait of couples using the Omni-Zero diffusion pipeline. This action allows for multiple identities and style customizations, making it an excellent choice for creating unique and artistic images.

Input

The input for this action consists of various fields that allow you to customize the portrait's attributes. Below is a breakdown of the required and optional fields based on the input_schema.

  • seed: (integer, optional) Random seed for the model. Use -1 for a random seed.
    Example: -1
  • prompt: (string, required) Text used to guide the model in image generation.
    Example: "Cinematic still photo of a couple. emotional, harmonious, vignette, 4k epic detailed, shot on kodak, 35mm photo, sharp focus, high budget, cinemascope, moody, epic, gorgeous, film grain, grainy"
  • baseImage: (string, required) URI of the base image used as a reference.
    Example: "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg"
  • depthImage: (string, optional) URI of the depth image used to inform depth details in the model.
  • styleImage: (string, required) URI of the style image used to guide the stylistic aspects.
    Example: "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg"
  • guidanceScale: (number, optional) Scale factor that guides the influence strength of the prompt.
    Example: 3
  • numberOfSteps: (integer, optional) Total number of iterative steps the model will perform.
    Example: 10
  • Other optional fields include identity images, negative prompts, and guidance strengths.

Here's an example JSON payload for the input:

{
  "seed": -1,
  "prompt": "Cinematic still photo of a couple. emotional, harmonious, vignette, 4k epic detailed, shot on kodak, 35mm photo, sharp focus, high budget, cinemascope, moody, epic, gorgeous, film grain, grainy",
  "baseImage": "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg",
  "styleImage": "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg",
  "guidanceScale": 3,
  "numberOfSteps": 10,
  "identityImage1": "https://cdn-prod.styleof.com/inferences/cm1hp4lea14oz14jeoghnex7g/dlgc5xwo0qzey7qaixy45i1o-medium.jpeg",
  "identityImage2": "https://cdn-prod.styleof.com/inferences/cm1ho69ha14np14jesnusqiep/mp3aaktzqz20ujco5i3bi5s1-medium.jpeg",
  "negativePrompt": "anime, cartoon, graphic, (blur, blurry, bokeh), text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
  "numberOfImages": 1,
  "maskGuidanceEnd": 1,
  "baseImageStrength": 0.3,
  "maskGuidanceStart": 0,
  "depthImageStrength": 0.2,
  "styleImageStrength": 1,
  "identityImageStrength1": 1,
  "identityImageStrength2": 1
}

Output

Upon successful execution, this action typically returns an array of URLs pointing to the generated images. Here’s an example of the expected output:

[
  "https://assets.cognitiveactions.com/invocations/f31afcc6-0d3d-408e-ab01-275725c5c340/a562cdd1-3cb0-497b-bd93-bd5591615373.jpg"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Cognitive Actions execution endpoint for the Create Stylized Couples Portrait action:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint

action_id = "b8b74998-aee1-4620-8432-5d4ccdae5ea0"  # Action ID for Create Stylized Couples Portrait

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "prompt": "Cinematic still photo of a couple. emotional, harmonious, vignette, 4k epic detailed, shot on kodak, 35mm photo, sharp focus, high budget, cinemascope, moody, epic, gorgeous, film grain, grainy",
    "baseImage": "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg",
    "styleImage": "https://cdn-prod.styleof.com/inferences/cm1ho5cjl14nh14jec6phg2h8/i6k59e7gpsr45ufc7l8kun0g-medium.jpeg",
    "guidanceScale": 3,
    "numberOfSteps": 10,
    "identityImage1": "https://cdn-prod.styleof.com/inferences/cm1hp4lea14oz14jeoghnex7g/dlgc5xwo0qzey7qaixy45i1o-medium.jpeg",
    "identityImage2": "https://cdn-prod.styleof.com/inferences/cm1ho69ha14np14jesnusqiep/mp3aaktzqz20ujco5i3bi5s1-medium.jpeg",
    "negativePrompt": "anime, cartoon, graphic, (blur, blurry, bokeh), text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
    "numberOfImages": 1,
    "maskGuidanceEnd": 1,
    "baseImageStrength": 0.3,
    "maskGuidanceStart": 0,
    "depthImageStrength": 0.2,
    "styleImageStrength": 1,
    "identityImageStrength1": 1,
    "identityImageStrength2": 1
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In the code snippet, replace the placeholder API key and endpoint with your actual values. The action_id should correspond to the Create Stylized Couples Portrait action, and the payload must be structured as shown above.

Conclusion

The Omni-Zero Cognitive Actions provide a powerful way to generate stylized couples portraits effortlessly. With the ability to customize various aspects of the image generation process, developers can create unique and engaging content for their applications. As a next step, consider experimenting with different prompts and images to explore the creative possibilities this action offers!