Enhance Your Application with Personalized Image Generation Using lucataco/sdxl-lcm-zeke Actions

23 Apr 2025
Enhance Your Application with Personalized Image Generation Using lucataco/sdxl-lcm-zeke Actions

In the world of image generation, the ability to create customized and fine-tuned images is invaluable for developers looking to enhance their applications. The lucataco/sdxl-lcm-zeke API offers a unique Cognitive Action that empowers developers to generate personalized images based on specific user inputs. This action leverages the SDXL-LCM LoRA model to produce high-quality visuals tailored to the needs of your application.

Prerequisites

Before diving into the integration of the Cognitive Action, ensure you have:

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests to interact with APIs.

Authentication typically involves passing your API key in the headers of your requests, allowing you to securely access the Cognitive Actions functionalities.

Cognitive Actions Overview

Generate Personalized Fine-Tuned Image

The Generate Personalized Fine-Tuned Image action allows developers to create a customized image model using user-provided images of Zeke. This action enhances image generation with specific customization controls, providing an intuitive way to generate images that meet personalized requirements.

  • Category: Image Generation

Input

The input schema for this action is structured as follows:

{
  "mask": "string (uri)",
  "seed": "integer",
  "image": "string (uri)",
  "width": "integer (default: 1024)",
  "height": "integer (default: 1024)",
  "prompt": "string (default: 'An astronaut riding a rainbow unicorn, cinematic, dramatic')",
  "scheduler": "string (default: 'LCM')",
  "customWeights": "string",
  "guidanceScale": "number (default: 2)",
  "applyWatermark": "boolean (default: true)",
  "negativePrompt": "string",
  "promptStrength": "number (default: 0.8)",
  "numberOfOutputs": "integer (default: 1)",
  "loraScalingFactor": "number (default: 0.6)",
  "numberOfInferenceSteps": "integer (default: 6)",
  "isSafetyCheckerDisabled": "boolean (default: false)"
}

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A photo of TOK",
  "scheduler": "LCM",
  "guidanceScale": 2,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "loraScalingFactor": 0.6,
  "numberOfInferenceSteps": 6
}

In this example, the input specifies the dimensions, prompt, scheduling algorithm, and other parameters that influence the image generation.

Output

Upon successful execution, this action typically returns a URL to the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/1e777344-d500-4375-a712-a9c8f902b236/b0bf3532-c0cb-49de-8f36-86df5d1502c5.png"
]

This URL links directly to the generated image, which can then be utilized within your application.

Conceptual Usage Example (Python)

Here’s how you might implement a call to this Cognitive 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 = "e3aa344e-9eb7-4b35-9e37-6ae2b97d013d"  # Action ID for Generate Personalized Fine-Tuned Image

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A photo of TOK",
    "scheduler": "LCM",
    "guidanceScale": 2,
    "applyWatermark": True,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "loraScalingFactor": 0.6,
    "numberOfInferenceSteps": 6
}

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, you replace the API key and endpoint with your actual credentials. The payload is structured to match the input requirements of the action, and the response is handled to ensure that any errors are properly communicated.

Conclusion

The Generate Personalized Fine-Tuned Image action from the lucataco/sdxl-lcm-zeke API offers developers a powerful tool for creating customized images tailored to user needs. By leveraging this action, you can enhance your applications, providing users with unique and personalized visuals. Consider integrating this functionality to explore the creative potential of image generation in your projects!