Create Stunning Images with the "booboo1232003/danimop" Cognitive Actions

23 Apr 2025
Create Stunning Images with the "booboo1232003/danimop" Cognitive Actions

In the realm of artificial intelligence and image generation, the booboo1232003/danimop specification offers a powerful Cognitive Action designed to transform textual descriptions into detailed images. This action leverages advanced image-to-image and inpainting techniques, allowing developers to create custom images with various parameters, including resolution, aspect ratio, and style enhancements. With the ability to optimize for speed or quality, these pre-built actions can significantly enhance your applications by automating image creation processes.

Prerequisites

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

  1. API Key: You'll need an API key to authenticate your requests to the Cognitive Actions platform.
  2. Endpoint Access: Familiarize yourself with the endpoint for executing actions, which will be used in your API calls.

Typically, authentication involves passing your API key in the headers of your HTTP requests.

Cognitive Actions Overview

Generate Image with Inpainting

The Generate Image with Inpainting action allows you to create images using detailed textual prompts and customizable parameters. This action is particularly useful for applications requiring unique image generation based on specific descriptions.

Input

The input schema for this action requires a structured JSON object. Here’s a breakdown of its key components:

  • prompt (required): A detailed textual description of the image to be generated.
  • goFast (optional): A boolean flag to enable speed optimization.
  • width (optional): Specifies the pixel width of the generated image (only in 'custom' aspect ratio).
  • height (optional): Specifies the pixel height of the generated image (only in 'custom' aspect ratio).
  • numOutputs (optional): The number of image outputs to generate (default is 1).

Here’s an example input JSON for this action:

{
  "goFast": false,
  "prompt": "A full body backside photo of Danimop. She is fit. She is wearing professional wrestling trunks and boots. She is looking over her shoulder. She is blonde. She is wearing eyeliner and mascara. She is mad. Her trunks are slightly pulled down. There is a small brown poop coming out the top of her trunks. She is standing. UHD. She is in a living room.",
  "loraScale": 1,
  "numOutputs": 4,
  "guidanceScale": 2.5,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageMegapixels": "1",
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "webp",
  "numInferenceSteps": 28
}

Output

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

[
  "https://assets.cognitiveactions.com/invocations/0f86200a-336f-4946-9ac7-fad2284bf017/61112733-004a-4a0d-9875-7faa5a6e3c7e.webp",
  "https://assets.cognitiveactions.com/invocations/0f86200a-336f-4946-9ac7-fad2284bf017/243ad0f2-7b27-4854-85ab-a01815430b0e.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call this action using Python, focusing on structuring the input JSON payload correctly:

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 = "6c13cd66-e079-49db-9195-8686dff30068"  # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "goFast": False,
    "prompt": "A full body backside photo of Danimop. She is fit. She is wearing professional wrestling trunks and boots. She is looking over her shoulder. She is blonde. She is wearing eyeliner and mascara. She is mad. Her trunks are slightly pulled down. There is a small brown poop coming out the top of her trunks. She is standing. UHD. She is in a living room.",
    "loraScale": 1,
    "numOutputs": 4,
    "guidanceScale": 2.5,
    "outputQuality": 80,
    "extraLoraScale": 1,
    "inferenceModel": "dev",
    "promptStrength": 0.8,
    "imageMegapixels": "1",
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "webp",
    "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 the code snippet above, replace the placeholder for the API key with your actual key. The payload variable is constructed based on the required input schema for the action, and the request is sent to the Cognitive Actions endpoint.

Conclusion

The booboo1232003/danimop Cognitive Actions provide a versatile tool for developers looking to integrate advanced image generation capabilities into their applications. By utilizing the Generate Image with Inpainting action, you can create stunning visuals tailored to your specifications, enhancing user engagement and creativity. To explore further, consider experimenting with different input parameters or combining multiple actions to achieve even more complex outcomes. Happy coding!