Create Stunning Images with the ernieatlyd-lora Cognitive Actions

21 Apr 2025
Create Stunning Images with the ernieatlyd-lora Cognitive Actions

In the ever-evolving landscape of AI-driven content creation, the ernieatlyd/ernieatlyd-lora API provides a powerful tool for developers looking to generate high-quality images. This API leverages the LoRA model to produce images based on customizable parameters, including image inpainting, prompt strength, and optimization modes for speed or quality. By integrating these pre-built Cognitive Actions into your applications, you can enhance user experience and creativity in innovative ways.

Prerequisites

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

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON format as you'll be working with JSON payloads for input and output.
  • Familiarity with making HTTP requests in your preferred programming language, such as Python.

Authentication is typically achieved by passing your API key in the request headers, which grants you access to the available actions.

Cognitive Actions Overview

Generate Image with LoRA Model

The Generate Image with LoRA Model action allows you to create images using a prompt and various parameters. This action is categorized under image-generation and offers extensive customization options for the output.

Purpose: This action generates images based on a provided prompt, with additional features such as inpainting and model selection for optimized performance.

Input

The required and optional fields for this action are defined in the input schema. Below is a breakdown of the essential parameters:

  • prompt (required): The textual description guiding the image generation (e.g., "ernieatlyd as a wizard in colorful robes looking straight into the camera").
  • model (optional): Choose between "dev" or "schnell" for different inference capabilities.
  • goFast (optional): Set to true for faster predictions with reduced quality.
  • imageAspectRatio (optional): Define the aspect ratio of the generated image.
  • numberOfOutputs (optional): Specify how many images to generate (1-4).
  • imageOutputFormat (optional): Format for the generated images (e.g., "webp", "jpg", "png").

Example Input:

{
  "model": "dev",
  "goFast": false,
  "prompt": "ernieatlyd as a wizard in colorful robes looking straight into the camera",
  "loraScale": 1,
  "megapixels": "1",
  "numberOfOutputs": 1,
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "webp",
  "imageGuidanceScale": 3,
  "imageOutputQuality": 80,
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8,
  "inferenceStepsCount": 28
}

Output

The action typically returns a URL link to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/2e382447-fdc6-4ac5-9475-db3854d0590e/efc318bc-f692-4e16-9750-930cad564231.webp"
]

Conceptual Usage Example (Python)

Here’s how you can call this action using a hypothetical API endpoint in 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 = "19a17fd6-1129-419f-a894-55ceef82a30f"  # Action ID for Generate Image with LoRA Model

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "ernieatlyd as a wizard in colorful robes looking straight into the camera",
    "loraScale": 1,
    "megapixels": "1",
    "numberOfOutputs": 1,
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "webp",
    "imageGuidanceScale": 3,
    "imageOutputQuality": 80,
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8,
    "inferenceStepsCount": 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 YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured according to the requirements of the action.

Conclusion

The ernieatlyd/ernieatlyd-lora Cognitive Actions empower developers to create stunning images tailored to specific prompts and parameters. With its ability to customize aspects such as model selection, output format, and image quality, this API offers vast possibilities for creative applications.

Consider exploring more use cases like generating artwork for games, creating marketing visuals, or even developing unique content for social media. The potential is endless!