Transform Your Images with the juddisjudd/deriksen Cognitive Actions

22 Apr 2025
Transform Your Images with the juddisjudd/deriksen Cognitive Actions

In the realm of image generation, the juddisjudd/deriksen cognitive actions provide developers with powerful tools to create stunning visuals through advanced AI models. These pre-built actions allow for both detailed and rapid image generation, making them ideal for a variety of applications ranging from artistic creation to practical inpainting tasks. By harnessing these actions, you can easily integrate sophisticated image generation capabilities into your applications without needing to delve into complex algorithms.

Prerequisites

Before getting started, ensure you have access to the Cognitive Actions platform, which requires an API key for authentication. The API key should be passed in the headers of your requests to securely authenticate your actions.

Cognitive Actions Overview

Generate Image with Model

Description: This action enables the generation of images using either an image-to-image or inpainting mode, utilizing models optimized for detailed or rapid predictions.

Category: Image Generation

Input

The input schema for this action includes several fields, with the prompt being mandatory. Here’s a breakdown of the required and optional fields:

  • prompt (required): A text prompt guiding the generation (e.g., "a photo of deriksen in a black and gold suit standing in a pawn shop canon eos 7d, realistic, 35mm").
  • model (optional): Specifies the model to use for inference, either "dev" or "schnell" (default: "dev").
  • width (optional): Width of the generated image (e.g., 702).
  • height (optional): Height of the generated image (e.g., 842).
  • numOutputs (optional): Number of output images to generate (default: 1).
  • aspectRatio (optional): Defines the aspect ratio for the generated image (default: "1:1").
  • outputFormat (optional): Specifies the format for the output images (default: "webp").
  • guidanceScale (optional): Influences the diffusion process's guidance scale (default: 3).
  • outputQuality (optional): Determines the quality of the output images (default: 80).
  • Additional parameters like seed, mask, promptStrength, goFast, disableImageSafetyChecker, and others can also be specified to customize the generation process.

Example Input:

{
  "model": "dev",
  "width": 702,
  "height": 842,
  "prompt": "a photo of deriksen in a black and gold suit standing in a pawn shop canon eos 7d, realistic, 35mm",
  "loraScale": 1,
  "numOutputs": 4,
  "aspectRatio": "1:1",
  "outputFormat": "png",
  "guidanceScale": 3.5,
  "outputQuality": 100,
  "extraLoraScale": 0.8,
  "numInferenceSteps": 28
}

Output

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

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/fd253d98-9c6a-4a1c-9b55-0e9916dc6625/4451e81b-f0b8-4d5d-951d-c1e002d0ed68.png",
  "https://assets.cognitiveactions.com/invocations/fd253d98-9c6a-4a1c-9b55-0e9916dc6625/e8e8d487-ef55-4a14-9976-b8f9d4cc5303.png",
  "https://assets.cognitiveactions.com/invocations/fd253d98-9c6a-4a1c-9b55-0e9916dc6625/40143139-db2f-4adc-a743-efa40de72e7a.png",
  "https://assets.cognitiveactions.com/invocations/fd253d98-9c6a-4a1c-9b55-0e9916dc6625/46602f5a-3582-4e2f-81fc-944738c28746.png"
]

Conceptual Usage Example (Python)

Here’s how you can utilize the action in your application using Python. This code snippet demonstrates how to call the action and structure your input:

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 = "737125e4-b25f-41dd-8ed1-3b8fee345da0" # Action ID for Generate Image with Model

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "width": 702,
    "height": 842,
    "prompt": "a photo of deriksen in a black and gold suit standing in a pawn shop canon eos 7d, realistic, 35mm",
    "loraScale": 1,
    "numOutputs": 4,
    "aspectRatio": "1:1",
    "outputFormat": "png",
    "guidanceScale": 3.5,
    "outputQuality": 100,
    "extraLoraScale": 0.8,
    "numInferenceSteps": 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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and payload are structured according to the requirements of the Generate Image with Model action.

Conclusion

The juddisjudd/deriksen Cognitive Actions open up a world of possibilities for developers looking to integrate image generation capabilities into their applications. By leveraging the Generate Image with Model action, you can create high-quality visuals tailored to your specific needs. Whether you're building creative projects or practical applications, these tools offer the flexibility and power to enhance your work dramatically. Start experimenting with these actions today to see the creative potential they unlock!