Create Stunning Images with the Umi Cognitive Actions

22 Apr 2025
Create Stunning Images with the Umi Cognitive Actions

In the world of AI and digital creativity, the ryokeken/umi Cognitive Actions offer a powerful way to generate captivating images. By leveraging advanced AI models, these actions allow developers to create images based on specific themes, such as "umi the cat," using various configuration options. The pre-built actions make it easy to integrate image generation capabilities into applications, saving time and effort while producing high-quality visuals.

Prerequisites

Before diving into the integration of these Cognitive Actions, you’ll need to ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • A basic understanding of JSON and how to send HTTP requests.
  • Familiarity with Python for the conceptual code examples provided.

Authentication typically involves passing your API key in the request headers to authorize access to the Cognitive Actions.

Cognitive Actions Overview

Generate Image with Umi

This action enables developers to generate images with various themes, specifically focusing on the "umi the cat" motif. The action supports multiple modes, including image-to-image and inpainting, allowing for significant customization in terms of resolution, guidance scale, and more.

Input

The required and optional fields for this action are defined in the input schema. Below is a breakdown of the main parameters:

  • prompt (required): A textual description of the image to generate.
  • model: Specifies which AI model to use for image generation (options: "dev" or "schnell").
  • aspectRatio: The desired aspect ratio for the output image.
  • outputFormat: The format in which the output image will be saved (options: "webp", "jpg", "png").

Here’s an example of a JSON payload for invoking this action:

{
  "model": "dev",
  "prompt": "a photo of UMIKAT the cat looking at the camera in the middle of Times Square in new york city",
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "promptStrength": 0.8,
  "loraWeightScale": 1,
  "numberOfOutputs": 1,
  "additionalLoraScale": 1,
  "numberOfInferenceSteps": 28
}

Output

The action typically returns an array of URLs pointing to the generated images. Here’s an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/9d967368-0c86-485c-9206-3e5bb81c723c/87ca2791-b26d-499a-9855-80b90fa90c02.webp"
]

Conceptual Usage Example (Python)

Below is a conceptual Python snippet demonstrating how to invoke the Generate Image with Umi 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 = "4cb0b9d7-9193-456f-bfaa-7a507551b524" # Action ID for Generate Image with Umi

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "a photo of UMIKAT the cat looking at the camera in the middle of Times Square in new york city",
    "aspectRatio": "1:1",
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "promptStrength": 0.8,
    "loraWeightScale": 1,
    "numberOfOutputs": 1,
    "additionalLoraScale": 1,
    "numberOfInferenceSteps": 28
}

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, replace the placeholder for COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is set to the one corresponding to the Generate Image with Umi action. The input payload is structured according to the action's requirements.

Conclusion

The ryokeken/umi Cognitive Actions provide developers with a straightforward way to create engaging images using AI. With customizable parameters for image generation, you can tailor the output to meet your specific needs. Start integrating these actions into your applications today and explore the creative possibilities they offer!