Generate Customized Images with the biggpt1/qwerty-logo Cognitive Actions

25 Apr 2025
Generate Customized Images with the biggpt1/qwerty-logo Cognitive Actions

In the realm of image generation, the biggpt1/qwerty-logo spec provides a powerful Cognitive Action called Generate Customized Images. This action enables developers to create personalized images with a plethora of options, including inpainting, aspect ratio customization, and rapid generation modes. By leveraging the unique features of this action, developers can enhance their applications with tailored visual content, making it ideal for creative projects, marketing materials, and more.

Prerequisites

Before using the Cognitive Actions, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic understanding of JSON structures and API requests.

To authenticate, you will typically pass your API key as a bearer token in the request headers when making API calls.

Cognitive Actions Overview

Generate Customized Images

The Generate Customized Images action allows you to create personalized images based on detailed textual prompts. It supports various image properties, including prompt strength, output quality, and model selection, providing flexibility to meet diverse needs in image generation.

Input

The input for this action is structured as follows:

  • Required Fields:
    • prompt: A string that describes the desired image.
  • Optional Fields:
    • mask: A URI to an image mask for inpainting mode.
    • seed: An integer to ensure consistent results across generations.
    • image: A URI to an input image for image-to-image transformations.
    • model: Choose between "dev" (28 inference steps) or "schnell" (4 inference steps).
    • width: Integer specifying the image width (256-1440).
    • height: Integer specifying the image height (256-1440).
    • aspectRatio: Options include "1:1", "16:9", "21:9", "custom", etc.
    • outputCount: Integer specifying how many images to generate (1-4).
    • outputFormat: Specify the format - "webp", "jpg", or "png".
    • guidanceScale: Number controlling the diffusion process guidance (0-10).
    • mainLoraScale: Number for scaling main LoRA weights (0-3).
    • outputQuality: Integer for image quality (0-100).
    • enableFastMode: Boolean to enable faster predictions.
    • promptStrength: Number (0-1) for adjusting prompt influence in img2img mode.
    • imageResolution: Options for image megapixels ("1" or "0.25").
    • inferenceStepCount: Integer for total denoising steps (1-50).
    • additionalLoraScale: Number for scaling additional LoRA weights (0-3).
    • safetyCheckerDisabled: Boolean to disable the safety checker for images.

Example Input:

{
  "model": "dev",
  "prompt": "Modern Minimalist Coffee Shop with QWRT Logo Integration...",
  "aspectRatio": "16:9",
  "outputCount": 4,
  "outputFormat": "png",
  "guidanceScale": 3.28,
  "mainLoraScale": 1,
  "outputQuality": 80,
  "enableFastMode": false,
  "promptStrength": 0.8,
  "imageResolution": "1",
  "inferenceStepCount": 28,
  "additionalLoraScale": 1
}

Output

Upon successful execution, the action returns an array of image URLs corresponding to the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/9cad6f85-2e88-44ad-853e-feba5039c52a/e89c02cd-c947-4d22-9d03-db1b51440377.png",
  "https://assets.cognitiveactions.com/invocations/9cad6f85-2e88-44ad-853e-feba5039c52a/8846eb6d-1774-468e-a2c9-7be01bc70aec.png",
  "https://assets.cognitiveactions.com/invocations/9cad6f85-2e88-44ad-853e-feba5039c52a/a26702ec-17e1-4966-9114-4f46fc3fdb0c.png",
  "https://assets.cognitiveactions.com/invocations/9cad6f85-2e88-44ad-853e-feba5039c52a/736737a2-9f48-4760-9348-4f7c5f71fe5f.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual example of how to 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 = "303ef9d8-0648-4982-9387-5e19020f109d"  # Action ID for Generate Customized Images

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "Modern Minimalist Coffee Shop with QWRT Logo Integration...",
    "aspectRatio": "16:9",
    "outputCount": 4,
    "outputFormat": "png",
    "guidanceScale": 3.28,
    "mainLoraScale": 1,
    "outputQuality": 80,
    "enableFastMode": False,
    "promptStrength": 0.8,
    "imageResolution": "1",
    "inferenceStepCount": 28,
    "additionalLoraScale": 1
}

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 the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload structure aligns with the requirements of the action, and the endpoint URL and request structure are illustrative.

Conclusion

The Generate Customized Images action from the biggpt1/qwerty-logo spec opens up numerous possibilities for developers looking to integrate advanced image generation capabilities into their applications. By leveraging the various customizable parameters, you can produce unique and tailored visuals that enhance user engagement and satisfaction.

Explore the potential of these Cognitive Actions and consider how they can elevate your next project!