Create Stunning Images with the mintkaori/seoulgi Cognitive Actions

22 Apr 2025
Create Stunning Images with the mintkaori/seoulgi Cognitive Actions

In the realm of digital creativity, the ability to generate and manipulate images has become increasingly accessible through advanced APIs. One such innovative solution is the mintkaori/seoulgi spec, which offers a powerful Cognitive Action to create enhanced images through an inpainting process. This action allows developers to produce customized images efficiently, utilizing features like image masking, adjustable dimensions, and multiple output formats. By integrating these pre-built actions, developers can significantly enhance their applications with advanced image generation capabilities.

Prerequisites

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

  • An API key for the Cognitive Actions platform, which will be used for authentication.
  • Familiarity with JSON data structures, as the input and output will be in JSON format.

Authentication typically involves including your API key in the headers of your HTTP requests, allowing secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Enhanced Images

Description:
This operation allows for the creation of customized images using an inpainting process. It supports features like image masking, fast mode prediction, customizable width and height, and multiple output formats. The operation leverages advanced image generation models such as 'dev' for detailed outputs and 'schnell' for speed, accommodating guidance and LoRA intensity settings for refined image fine-tuning.

Category: image-generation

Input

The input schema for this action requires the following fields:

  • prompt (string, required): The text prompt for generating the image. Including specific trigger words can enhance image styling.
  • mask (string, optional): URI to an image mask for inpainting mode.
  • image (string, optional): URI to the input image for conversions or inpainting.
  • model (string, optional): Model selection; defaults to "dev". Options are "dev" or "schnell".
  • width (integer, optional): Width of the generated image (only applicable if aspect_ratio is 'custom').
  • height (integer, optional): Height of the generated image (only applicable if aspect_ratio is 'custom').
  • aspectRatio (string, optional): Aspect ratio for the image. Defaults to "1:1".
  • outputCount (integer, optional): Number of images to generate, ranging from 1 to 4.
  • outputFormat (string, optional): Format for the output images, defaulting to "webp".
  • guidanceScale (number, optional): Adjusts the guidance scale for the diffusion process.
  • loraIntensity (number, optional): Intensity of the main LoRA application.

Example Input:

{
  "model": "dev",
  "prompt": "SEOULGI, running, SD size animation character, simple",
  "aspectRatio": "1:1",
  "outputCount": 4,
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "loraIntensity": 1,
  "outputQuality": 80,
  "inferenceSteps": 28,
  "additionalLoraIntensity": 0.8
}

Output

The output of this action typically returns an array of image URLs, each pointing to the generated images based on the parameters provided.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/900979ac-1e88-4ad0-8d95-9315b40e491d/5357a762-2b56-4b3f-8dc4-5a80e7154a02.webp",
  "https://assets.cognitiveactions.com/invocations/900979ac-1e88-4ad0-8d95-9315b40e491d/915fa23e-1548-4944-8514-ad1e11127f99.webp",
  "https://assets.cognitiveactions.com/invocations/900979ac-1e88-4ad0-8d95-9315b40e491d/a885d164-e12c-4167-a8f3-e3e7c70c786f.webp",
  "https://assets.cognitiveactions.com/invocations/900979ac-1e88-4ad0-8d95-9315b40e491d/f929b1a3-9af6-4c49-b21e-cd3808e5aab8.webp"
]

Conceptual Usage Example (Python)

Here’s how you could structure a request to execute the action 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 = "fbb281d0-a058-4b90-ba7a-3b848f6476de"  # Action ID for Generate Enhanced Images

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "SEOULGI, running, SD size animation character, simple",
    "aspectRatio": "1:1",
    "outputCount": 4,
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "loraIntensity": 1,
    "outputQuality": 80,
    "inferenceSteps": 28,
    "additionalLoraIntensity": 0.8
}

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 snippet, the action ID and input payload are structured precisely for the Cognitive Actions execution. The endpoint URL and request format are illustrative, focusing on how to prepare the input JSON correctly.

Conclusion

The mintkaori/seoulgi Cognitive Actions offer developers a powerful toolset for generating customized images with ease. By leveraging the capabilities of this action, you can bring your creative projects to life, whether it’s for gaming, animation, or any other visual content needs. Consider exploring this action further to enhance your applications with advanced image generation features, and don't hesitate to experiment with the various input parameters to achieve your desired results.