Transform Your Images with the rushnrx/countveri Cognitive Actions

24 Apr 2025
Transform Your Images with the rushnrx/countveri Cognitive Actions

In the world of image processing and generation, the rushnrx/countveri spec offers powerful Cognitive Actions designed to transform and create stunning visuals with ease. These pre-built actions enable developers to leverage advanced image generation capabilities without diving deep into the complexities of machine learning models. In this article, we will explore how to utilize the "Generate Inpainted Image" action, allowing you to create customized images based on textual prompts or existing images.

Prerequisites

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

  • API Key: You'll need a valid API key for the Cognitive Actions platform to authenticate your requests.
  • Setup: Familiarize yourself with how to include the API key in the headers of your requests to authenticate and gain access to the Cognitive Actions.

Authentication typically involves passing the API key in the request headers, ensuring secure access to the service.

Cognitive Actions Overview

Generate Inpainted Image

Description: This action generates inpainted or transformed images using either the 'dev' or 'schnell' inference models. The 'dev' model is optimal for detailed outputs, while the 'schnell' model focuses on speed. Developers can customize dimensions, aspect ratio, and quality, as well as enhance the generation process using a text prompt.

Category: Image Generation

Input: The input for this action is defined by a schema that includes several optional and required fields. Below is an overview of the key parameters:

  • prompt (required): A text prompt guiding the image generation process.
  • mask (optional): URI for an image mask used in inpainting mode.
  • image (optional): URI for an input image used in image-to-image or inpainting mode.
  • width (optional): Width of the generated image (if aspect ratio is set to 'custom').
  • height (optional): Height of the generated image (if aspect ratio is set to 'custom').
  • loraScale (optional): Intensity of the primary LoRA model application.
  • outputCount (optional): Number of images to generate (1 to 4).
  • guidanceScale (optional): Controls the guidance scale for the diffusion process.
  • enableFastMode (optional): Enables faster predictions using an optimized model.

Here’s an example of a JSON payload that might be used when calling this action:

{
  "width": 1440,
  "height": 1440,
  "prompt": "KOUNTVERI, 3d realistic blue robot with a smiling face, holding a bitcoin. The robot has \"VERI\" written on its chest. whimsical atmosphere, lake in the background. The playful cute chibi robot.",
  "loraScale": 1.1,
  "outputCount": 4,
  "guidanceScale": 4,
  "outputQuality": 100,
  "enableFastMode": false,
  "modelSelection": "dev",
  "imageMegapixels": "1",
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "png",
  "inferenceStepCount": 50,
  "additionalLoraIntensity": 1
}

Output: The action typically returns a list of URLs pointing to the generated images. Below is an example of what you might receive:

[
  "https://assets.cognitiveactions.com/invocations/193b210d-2a10-435e-b996-ecb8342c73a6/5a622b16-7baa-4931-babb-d16b4232b539.png",
  "https://assets.cognitiveactions.com/invocations/193b210d-2a10-435e-b996-ecb8342c73a6/5a35c5a2-b302-4bdd-bf1a-1ea1bd0e6edc.png",
  "https://assets.cognitiveactions.com/invocations/193b210d-2a10-435e-b996-ecb8342c73a6/ab0a4a97-07c1-45ae-bc3d-25af8d2c72d0.png",
  "https://assets.cognitiveactions.com/invocations/193b210d-2a10-435e-b996-ecb8342c73a6/291008f7-dbe1-4fe5-a3c1-18c2db9f52da.png"
]

Conceptual Usage Example (Python):

Here's how a developer might call the 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 = "170dffc7-ecb3-4bc0-9cfc-0d40244da586" # Action ID for Generate Inpainted Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1440,
    "height": 1440,
    "prompt": "KOUNTVERI, 3d realistic blue robot with a smiling face, holding a bitcoin. The robot has \"VERI\" written on its chest. whimsical atmosphere, lake in the background. The playful cute chibi robot.",
    "loraScale": 1.1,
    "outputCount": 4,
    "guidanceScale": 4,
    "outputQuality": 100,
    "enableFastMode": False,
    "modelSelection": "dev",
    "imageMegapixels": "1",
    "promptIntensity": 0.8,
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "png",
    "inferenceStepCount": 50,
    "additionalLoraIntensity": 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 this code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured according to the action's requirements, and the request is sent to the hypothetical Cognitive Actions execution endpoint.

Conclusion

The rushnrx/countveri Cognitive Actions provide powerful tools for generating and transforming images effortlessly. With the "Generate Inpainted Image" action, developers can create visually stunning outputs simply by providing a text prompt or existing image. Whether you're building a creative application or enhancing existing workflows, these actions can significantly streamline your image generation processes.

Experiment with the parameters and explore the potential of these Cognitive Actions to elevate your projects!