Generate Stunning Debiased Images with datacte/mobius Cognitive Actions

23 Apr 2025
Generate Stunning Debiased Images with datacte/mobius Cognitive Actions

In today's fast-paced digital landscape, image generation plays a crucial role in various applications, from advertising to virtual reality. The datacte/mobius API offers an innovative set of Cognitive Actions designed to leverage advanced image generation capabilities, specifically focusing on debiasing and enhancing representation across styles and domains. By integrating these pre-built actions, developers can effortlessly create high-quality, customized images while ensuring they align with ethical standards.

Prerequisites

Before you dive into using the Cognitive Actions, make sure you have the following:

  • An API key for accessing the datacte/mobius Cognitive Actions platform.
  • Basic knowledge of making API calls and handling JSON data.
  • Familiarity with Python (or your preferred programming language) to implement the API requests.

To authenticate your requests, you will typically pass the API key in the request headers, ensuring secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Debiased Images Using Mobius

The Generate Debiased Images Using Mobius action utilizes the Mobius model to create images while effectively mitigating biases. This state-of-the-art diffusion model excels in diverse styles and contexts, making it a versatile choice for developers looking to generate high-quality, debiased images without extensive pretraining.

Input

The input for this action is structured as follows:

  • seed (optional): A random seed for generating deterministic outputs. If left unspecified, the output will be randomized.
  • width (optional): Specifies the width of the output image in pixels. Selectable values range from 128 to 2048, with a default of 1024.
  • height (optional): Specifies the height of the output image in pixels. Selectable values range from 128 to 2048, with a default of 1024.
  • prompt (required): A textual input that describes the desired content and context for the output image.
  • scheduler (optional): Chooses the algorithm for image generation steps. Options include DDIM, K_EULER, DPMSolverMultistep (default), K_EULER_ANCESTRAL, PNDM, and KLMS.
  • guidanceScale (optional): Determines the strength of guidance applied during image generation, with valid values between 1 and 20; the default is 7.5.
  • negativePrompt (optional): Specifies elements to exclude from the generated image.
  • numberOfOutputs (optional): Indicates how many output images to generate (default is 1, with a maximum of 4).
  • numberOfInferenceSteps (optional): Sets the number of denoising steps in generating each image (default is 50).

Here’s an example input JSON payload:

{
  "width": 1024,
  "height": 1024,
  "prompt": "The image features an older man, a long white beard and mustache, He has a stern expression, giving the impression of a wise and experienced individual. The mans beard and mustache are prominent, adding to his distinguished appearance. The close-up shot of the mans face emphasizes his facial features and the intensity of his gaze.",
  "scheduler": "DPMSolverMultistep",
  "guidanceScale": 3,
  "numberOfOutputs": 1,
  "numberOfInferenceSteps": 50
}

Output

Upon executing the action, you will receive a response containing an array of URLs to the generated images. Here’s an example output:

[
  "https://assets.cognitiveactions.com/invocations/7399dca0-af23-4d4d-bd0e-695355bb7061/39d622d7-1d32-47b7-a563-69756c1968ff.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Debiased Images Using Mobius action using Python:

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 = "8c6398a5-c688-4bfe-bb5f-8a7e9133ea5f" # Action ID for Generate Debiased Images Using Mobius

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "The image features an older man, a long white beard and mustache, He has a stern expression, giving the impression of a wise and experienced individual. The mans beard and mustache are prominent, adding to his distinguished appearance. The close-up shot of the mans face emphasizes his facial features and the intensity of his gaze.",
    "scheduler": "DPMSolverMultistep",
    "guidanceScale": 3,
    "numberOfOutputs": 1,
    "numberOfInferenceSteps": 50
}

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 this code snippet, you need to replace the API key and endpoint with your actual values. The input payload is structured according to the action's requirements, and the response is handled to provide insights into the result of the action.

Conclusion

The datacte/mobius Cognitive Actions provide an exceptional way to generate debiased images, enhancing the representation and eliminating biases in visual content. By leveraging these actions, developers can create unique images tailored to specific needs, ensuring both quality and ethical standards. Now that you understand how to integrate these capabilities into your applications, consider exploring more complex use cases or combining them with other cognitive features to maximize their potential. Happy coding!