Elevate Your Image Generation with jborgesdb/lamuritechsuite Cognitive Actions

22 Apr 2025
Elevate Your Image Generation with jborgesdb/lamuritechsuite Cognitive Actions

In today’s digital landscape, generating high-quality images programmatically has become an essential capability for many applications. The jborgesdb/lamuritechsuite offers a powerful Cognitive Action designed to facilitate image creation through advanced inpainting techniques. This action allows developers to create stunning images while utilizing customizable settings that enhance both speed and quality. In this article, we’ll explore how to leverage this Cognitive Action effectively in your applications.

Prerequisites

Before diving into the integration, ensure you have an API key for the Cognitive Actions platform. Authentication typically involves including your API key in the request headers, enabling secure access to the Cognitive Actions endpoint.

Cognitive Actions Overview

Generate Image with Inpainting and Custom Settings

Description: This action enables the creation of detailed images using an inpainting method with flexible settings for image dimensions, output formats, and style influences. It supports two rendering modes: 'dev' for detailed images and 'schnell' for faster image generation.

Category: Image Generation

Input

The following fields are required and optional:

  • Required:
    • prompt: A text description guiding the image generation (example provided below).
  • Optional:
    • mask: URI for an image mask used in inpainting mode.
    • seed: Integer for generating reproducible outputs.
    • image: URI of an input image.
    • width: Width of the generated image when aspect ratio is 'custom'.
    • height: Height of the generated image when aspect ratio is 'custom'.
    • modelType: Selects the model for image generation ('dev' or 'schnell').
    • aspectRatio: Predefined or custom aspect ratio for the image.
    • outputCount: Number of images to generate (1 to 4).
    • outputFormat: File format for output images (e.g., webp, jpg, png).
    • guidanceScale: Float value influencing diffusion guidance.
    • loraIntensity: Controls the influence of the primary LoRA.
    • outputQuality: Integer quality scale for image files.
    • inferenceSteps: Number of denoising steps.
    • promptStrength: Float representing prompt influence in img2img mode.
    • externalWeights: URI to load external LoRA weights.
    • safetyCheckerDisabled: Toggle safety checks for generated images.

Example Input:

{
  "prompt": "Generate an image of a man walking in LAMURITECHSUITS looking away in a black jacket, white t-shirt, black pants, and black-and-white sneakers standing on the terrace of a luxurious Italian villa. The terrace overlooks meticulously manicured gardens with tall cypress trees, statues, and stone pathways. The scene should exude sophistication, with the old-world villa adding a touch of timeless elegance to the modern outfit",
  "modelType": "dev",
  "aspectRatio": "4:5",
  "outputCount": 2,
  "outputFormat": "webp",
  "guidanceScale": 3,
  "loraIntensity": 1,
  "outputQuality": 95,
  "inferenceSteps": 28,
  "promptStrength": 0.9,
  "additionalLoraIntensity": 1
}

Output

The action returns an array of URLs pointing to the generated images. Each URL links to an output image based on the input specifications.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/8828ef18-a5a8-406a-84a6-d41860db3d64/a77d3b4c-ac94-49de-a2a2-a2e07bd9979c.webp",
  "https://assets.cognitiveactions.com/invocations/8828ef18-a5a8-406a-84a6-d41860db3d64/005cc3f1-6cf1-464e-856c-641afbb651e7.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call the Cognitive Actions execution endpoint to generate an image 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 = "3d14894f-e4cf-40b3-919f-bb300ceec558" # Action ID for Generate Image with Inpainting and Custom Settings

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "Generate an image of a man walking in LAMURITECHSUITS looking away in a black jacket, white t-shirt, black pants, and black-and-white sneakers standing on the terrace of a luxurious Italian villa. The terrace overlooks meticulously manicured gardens with tall cypress trees, statues, and stone pathways. The scene should exude sophistication, with the old-world villa adding a touch of timeless elegance to the modern outfit",
    "modelType": "dev",
    "aspectRatio": "4:5",
    "outputCount": 2,
    "outputFormat": "webp",
    "guidanceScale": 3,
    "loraIntensity": 1,
    "outputQuality": 95,
    "inferenceSteps": 28,
    "promptStrength": 0.9,
    "additionalLoraIntensity": 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 Python snippet, you will see how the action ID and input payload are structured. The endpoint URL and request structure are illustrative, emphasizing the need to format your request correctly for successful image generation.

Conclusion

The jborgesdb/lamuritechsuite Cognitive Actions provide a robust solution for developers looking to integrate advanced image generation capabilities into their applications. With customizable parameters for quality, style, and rendering speed, this action opens up exciting possibilities for creative projects. Start experimenting with these features and elevate your application’s visual content today!