Elevate Your Image Generation with devilminun/aisqueegee2 Cognitive Actions

22 Apr 2025
Elevate Your Image Generation with devilminun/aisqueegee2 Cognitive Actions

In the world of AI-driven creativity, the devilminun/aisqueegee2 API offers powerful Cognitive Actions that allow developers to generate stunning images through advanced inpainting and custom models. With options for image formats, sizes, and guidance scales, these pre-built actions simplify the image generation process, making it accessible for your applications.

Prerequisites

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

  • API Key: You will need an API key for accessing the Cognitive Actions platform.
  • Setup: Familiarity with making HTTP requests and handling JSON data will be beneficial.

For authentication, you will typically pass your API key in the headers of your requests.

Cognitive Actions Overview

Generate Image with Inpainting and Custom Model

The Generate Image with Inpainting and Custom Model action allows you to create images using inpainting techniques and select between two custom models (dev for detailed results and schnell for faster processing). This action also supports features like image masking and prompt adjustments for refined image generation.

Input

The input schema for this action requires a prompt and can include various optional fields. Below is an overview of the input properties:

  • prompt (string, required): The text prompt to generate the image (e.g., "AISQUEEGEE squeegee is being used to clean the floor, female model").
  • mask (string, optional): URI for the image mask used in inpainting mode.
  • seed (integer, optional): Random seed for reproducible results.
  • image (string, optional): URI of the input image for inpainting.
  • model (string, optional): Model to use (dev or schnell, default is dev).
  • width (integer, optional): Width of the generated image (between 256 and 1440).
  • height (integer, optional): Height of the generated image (between 256 and 1440).
  • numOutputs (integer, optional): Number of image outputs to generate (1 to 4).
  • guidanceScale (number, optional): Adjusts the guidance scale for the diffusion process (0 to 10).
  • outputQuality (integer, optional): Image quality scale from 0 (low) to 100 (best).
  • imageOutputFormat (string, optional): Format for saving output images (options: "webp", "jpg", "png").
  • (Other optional fields include goFast, aspectRatioOption, numInferenceSteps, etc.)
Example Input
{
  "model": "dev",
  "prompt": "AISQUEEGEE squeegee is being used to clean the floor, female model",
  "loraScale": 1,
  "numOutputs": 1,
  "guidanceScale": 3.5,
  "outputQuality": 100,
  "extraLoraScale": 1,
  "promptStrength": 1,
  "aspectRatioOption": "1:1",
  "imageOutputFormat": "jpg",
  "numInferenceSteps": 28
}

Output

Upon successful execution, this action returns a URL link to the generated image. Below is an example output:

[
  "https://assets.cognitiveactions.com/invocations/ab1c866b-d495-4971-a0be-c93b67853cf4/118c6480-c87f-4244-a09c-9b23bd9e89c6.jpg"
]

Conceptual Usage Example (Python)

Here’s how you might call this 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 = "4796d37a-4efd-49c7-a51c-bd0dbd778791" # Action ID for Generate Image with Inpainting and Custom Model

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "AISQUEEGEE squeegee is being used to clean the floor, female model",
    "loraScale": 1,
    "numOutputs": 1,
    "guidanceScale": 3.5,
    "outputQuality": 100,
    "extraLoraScale": 1,
    "promptStrength": 1,
    "aspectRatioOption": "1:1",
    "imageOutputFormat": "jpg",
    "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 code snippet, replace the placeholder for your API key and specify the action ID. The payload is structured to meet the action's input requirements.

Conclusion

The devilminun/aisqueegee2 Cognitive Actions provide a robust framework for generating unique images through inpainting and custom models. By leveraging these actions, developers can easily integrate advanced image generation capabilities into their applications. Explore the possibilities and start creating today!