Create Stunning Images with the imcobrandsom/careismatics_blue Cognitive Actions

24 Apr 2025
Create Stunning Images with the imcobrandsom/careismatics_blue Cognitive Actions

In today's digital landscape, the ability to generate compelling images programmatically can transform applications and user experiences. The imcobrandsom/careismatics_blue Cognitive Actions provide a powerful toolset for developers to create images using custom prompts and settings. With features such as image-to-image translation, inpainting, and adjustable parameters for quality and dimensions, these actions simplify the image generation process while maintaining flexibility and control.

Prerequisites

Before diving into the usage of Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON format, as the input and output for these actions will be structured in this format.
  • Familiarity with making HTTP requests using libraries such as requests in Python.

Authentication typically involves passing your API key in the headers of your requests.

Cognitive Actions Overview

Generate Image with Custom Settings

The Generate Image with Custom Settings action allows developers to create images based on specific input prompts. This action supports various customization options, including image dimensions, quality, and the use of different models optimized for speed or detail.

Input

The input for this action follows a structured JSON schema, with several required and optional properties:

  • prompt (required): Text input that influences the generated image. For example, "A doctor in navy blue scrubs (careismatics_blue) sits across from a patient..."
  • model (optional): Chooses the inference model. Options are "dev" (default) and "schnell".
  • aspectRatio (optional): Defines the aspect ratio of the image (e.g., "1:1").
  • outputFormat (optional): Specifies the output image format (e.g., "jpg").
  • numberOfOutputs (optional): The number of images to generate, with a maximum of 4.

Here's an example of the input payload:

{
  "model": "dev",
  "prompt": "A doctor in navy blue scrubs (careismatics_blue) sits across from a patient in a bright medical consultation room...",
  "aspectRatio": "1:1",
  "outputFormat": "jpg",
  "guidanceScale": 2,
  "outputQuality": 80,
  "enableFastMode": false,
  "promptStrength": 0.8,
  "numberOfOutputs": 3
}

Output

The output of this action is a JSON array containing the URLs of the generated images. For example:

[
  "https://assets.cognitiveactions.com/invocations/23f6a5ca-8730-4c8b-a00a-1a2c1fc75e60/43b30e54-895b-4e00-8469-5ebc8abd9c74.jpg",
  "https://assets.cognitiveactions.com/invocations/23f6a5ca-8730-4c8b-a00a-1a2c1fc75e60/e4f73245-fa85-4876-b06d-5e45909c078f.jpg",
  "https://assets.cognitiveactions.com/invocations/23f6a5ca-8730-4c8b-a00a-1a2c1fc75e60/c31db4a5-6382-4e0f-905f-a26d5ef396e6.jpg"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Image with Custom Settings 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 = "4d3da979-029a-4010-bbd5-5e8cf66c2ad4" # Action ID for Generate Image with Custom Settings

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "A doctor in navy blue scrubs (careismatics_blue) sits across from a patient in a bright medical consultation room...",
    "aspectRatio": "1:1",
    "outputFormat": "jpg",
    "guidanceScale": 2,
    "outputQuality": 80,
    "enableFastMode": False,
    "promptStrength": 0.8,
    "numberOfOutputs": 3
}

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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is set for the "Generate Image with Custom Settings" action, and the input payload is structured according to the schema provided.

Conclusion

The imcobrandsom/careismatics_blue Cognitive Actions offer developers a robust framework for generating high-quality images tailored to specific needs. By leveraging these actions, you can enhance your applications with visually appealing content generated dynamically. Explore the various parameters available to customize your image outputs further, and consider integrating this functionality into your next project to elevate user engagement. Happy coding!