Generate Stunning Images with the DalesogBottle Cognitive Actions

24 Apr 2025
Generate Stunning Images with the DalesogBottle Cognitive Actions

In the realm of AI-driven creativity, the DalesogBottle Cognitive Actions provide a powerful and flexible API that allows developers to generate images through sophisticated inpainting techniques. With customizable parameters for aspect ratio, resolution, and output format, these pre-built actions can enhance your applications with compelling visual content. Whether you're building a creative tool or enhancing existing features, integrating these actions can elevate user experience by generating high-quality images based on textual prompts.

Prerequisites

To get started with the DalesogBottle Cognitive Actions, you'll need:

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of making HTTP requests and handling JSON payloads.

Conceptually, authentication can be done by passing your API key in the headers of your requests.

Cognitive Actions Overview

Generate Image with Inpainting

Description: This action generates an image using inpainting mode, allowing developers to craft images with customizable properties. It supports advanced features such as LoRA weights and enhanced prompt strength, making it suitable for a variety of creative tasks.

  • Category: image-generation

Input:

The input schema for this action requires at least a prompt and can include a variety of optional fields. Here’s a breakdown of the required and optional inputs:

  • Required Fields:
    • prompt: A string that describes what the generated image should depict.
  • Optional Fields:
    • mask: URI of the image mask for inpainting.
    • seed: Integer for reproducible generation.
    • image: URI of the input image.
    • model: Selects the inference model (dev or schnell).
    • width and height: Dimensions for the image (if aspect ratio is custom).
    • goFast: Enables faster predictions.
    • imageFormat: Specifies the output image format (webp, jpg, png).
    • imageQuality: Quality of the output image (0-100).
    • denoisingSteps: Number of steps for image generation (1-50).
    • numberOfOutputs: How many images to generate (1-4).
    • aspectRatioOption: Aspect ratio for the generated image.
    • additionalLoraScale: Adjusts intensity for additional LoRA.

Example Input:

{
  "model": "dev",
  "goFast": false,
  "prompt": "DALESOGBOTTLE filled with black liquid, sitting on a kitchen table in soft afternoon light",
  "loraScale": 1,
  "megapixels": "1",
  "imageFormat": "jpg",
  "imageQuality": 80,
  "denoisingSteps": 28,
  "numberOfOutputs": 4,
  "promptIntensity": 0.8,
  "aspectRatioOption": "4:5",
  "additionalLoraScale": 1,
  "diffusionGuidanceScale": 3
}

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/36cca2e4-b81f-4699-98f1-ab19452115ae/672c40d9-db34-419a-958e-0f08c4f86b2a.jpg",
  "https://assets.cognitiveactions.com/invocations/36cca2e4-b81f-4699-98f1-ab19452115ae/8596fb3d-44d3-4c2c-a02f-db2e84abcf69.jpg",
  "https://assets.cognitiveactions.com/invocations/36cca2e4-b81f-4699-98f1-ab19452115ae/980fe697-2bc4-4bd9-8702-c067bf68b627.jpg",
  "https://assets.cognitiveactions.com/invocations/36cca2e4-b81f-4699-98f1-ab19452115ae/49ec3693-d385-41b1-896d-6c9bcf9ab005.jpg"
]

Conceptual Usage Example (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 = "455e243e-2df9-4c33-a245-4f3d613817b1"  # Action ID for Generate Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "DALESOGBOTTLE filled with black liquid, sitting on a kitchen table in soft afternoon light",
    "loraScale": 1,
    "megapixels": "1",
    "imageFormat": "jpg",
    "imageQuality": 80,
    "denoisingSteps": 28,
    "numberOfOutputs": 4,
    "promptIntensity": 0.8,
    "aspectRatioOption": "4:5",
    "additionalLoraScale": 1,
    "diffusionGuidanceScale": 3
}

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 Python code snippet, replace the placeholders with your actual API key and endpoint. The action_id corresponds to the "Generate Image with Inpainting" action, and the payload is structured according to the action's input schema.

Conclusion

The DalesogBottle Cognitive Actions empower developers to create stunning images directly from textual prompts, offering extensive customization for output quality and format. With capabilities like inpainting and LoRA weights, these actions can significantly enhance the visual aspects of your applications. Consider exploring further possibilities by integrating additional functionalities or experimenting with different parameters to unlock the full potential of image generation. Happy coding!