Transform Your Images with exdatic/tortengenerator Cognitive Actions

23 Apr 2025
Transform Your Images with exdatic/tortengenerator Cognitive Actions

In the era of digital creativity, the ability to generate visually stunning images through automation can significantly enhance application capabilities. The exdatic/tortengenerator offers a powerful set of Cognitive Actions designed specifically for image generation. With advanced features like inpainting, refined steps, and customizable prompts, developers can easily integrate these actions into their applications to produce high-quality visual content.

Prerequisites

Before diving into the integration of these Cognitive Actions, ensure that you have:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON and HTTP requests since the Cognitive Actions will require structured inputs.

Typically, authentication is handled by passing the API key in the headers of your requests, ensuring secure access to the required actions.

Cognitive Actions Overview

Generate Enhanced Image

The Generate Enhanced Image action allows developers to create visually enhanced images from provided input. Utilizing either the img2img or inpainting modes, this action offers advanced options for mask application, refined steps, and various scheduling algorithms, ensuring the output is of high quality and detail.

  • Category: Image Generation

Input

The input for this action is structured as follows:

{
  "mask": "https://example.com/mask.png", 
  "seed": 12345, 
  "image": "https://example.com/input_image.png", 
  "width": 1024, 
  "height": 1024, 
  "prompt": "a TOK cake showing Dresden city", 
  "loraScale": 0.6, 
  "refineSteps": 10, 
  "refineStyle": "expert_ensemble_refiner", 
  "modelWeights": "", 
  "guidanceScale": 7.5, 
  "applyWatermark": true, 
  "negativePrompt": "", 
  "promptStrength": 0.8, 
  "outputImageCount": 1, 
  "highNoiseFraction": 0.8, 
  "inferenceStepsCount": 50, 
  "schedulingAlgorithm": "K_EULER", 
  "disableSafetyChecker": false
}
  • Required Fields: image, prompt, width, height
  • Optional Fields: mask, seed, loraScale, refineSteps, refineStyle, modelWeights, guidanceScale, applyWatermark, negativePrompt, promptStrength, outputImageCount, highNoiseFraction, inferenceStepsCount, schedulingAlgorithm, disableSafetyChecker.

Output

Upon successful execution, the action typically returns a URL pointing to the generated image, for example:

[
  "https://assets.cognitiveactions.com/invocations/561d7cf5-b961-4764-aad3-80c86f40019b/ef6f1483-f4ef-4080-8e80-bb182df9752d.png"
]

Conceptual Usage Example (Python)

Here’s how a developer might call the Generate Enhanced Image 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 = "08eaba44-341f-42df-aaa9-f3f15c1046e8"  # Action ID for Generate Enhanced Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "a TOK cake showing Dresden city",
    "loraScale": 0.6,
    "refineStyle": "expert_ensemble_refiner",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "outputImageCount": 1,
    "highNoiseFraction": 0.8,
    "inferenceStepsCount": 50,
    "schedulingAlgorithm": "K_EULER"
}

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}
    )
    response.raise_for_status()

    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 Python snippet:

  • The action_id variable holds the ID for the Generate Enhanced Image action.
  • The payload variable is constructed according to the required input schema.
  • The requests library is used to send a POST request to the hypothetical Cognitive Actions endpoint.

Conclusion

The exdatic/tortengenerator Cognitive Actions provide a robust framework for generating enhanced images tailored to your application's needs. By utilizing actions such as Generate Enhanced Image, developers can streamline creative processes and produce stunning visuals effortlessly. Consider experimenting with different input parameters to discover the full potential of these actions in your projects!