Create Stunning Liniers-Style Drawings with chukososa Cognitive Actions

22 Apr 2025
Create Stunning Liniers-Style Drawings with chukososa Cognitive Actions

Integrating artistic flair into applications has never been easier with the chukososa/estilo-liniers Cognitive Actions. This powerful API allows developers to generate colorful drawings in the distinctive style of Liniers, utilizing a custom-trained model. With pre-built actions, you can effortlessly create captivating images, making it an excellent resource for artists, designers, and developers looking to enhance their projects with unique visual content.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests in your preferred programming language.

For authentication, you will typically pass your API key in the request headers, ensuring secure access to the Cognitive Actions platform.

Cognitive Actions Overview

Generate Liniers Style Drawing

The Generate Liniers Style Drawing action produces vibrant images that capture the unique essence of Liniers' artistic style. This action is categorized under image-generation.

Input

The action accepts a range of parameters to customize the image generation:

  • mask (string, optional): URI of the input mask for inpaint mode.
  • seed (integer, optional): Random seed for initializing image generation.
  • image (string, optional): URI of the input image for img2img or inpaint mode.
  • width (integer, default: 1024): Width of the output image in pixels.
  • height (integer, default: 1024): Height of the output image in pixels.
  • prompt (string, default: "An astronaut riding a rainbow unicorn"): Text prompt guiding the image generation.
  • loraScale (number, default: 0.6): LoRA additive scale factor.
  • outputCount (integer, default: 1): Number of images to generate (max 4).
  • refineStyle (string, default: "no_refiner"): Style for refining the output image.
  • modelWeights (string, optional): Specifies the LoRA weights to use.
  • guidanceScale (number, default: 7.5): Scale for classifier-free guidance.
  • applyWatermark (boolean, default: true): Flag to apply a watermark to generated images.
  • negativePrompt (string, optional): Text prompt specifying elements to exclude.
  • promptStrength (number, default: 0.8): Influence strength of the prompt.
  • schedulingType (string, default: "K_EULER"): Scheduling algorithm type for image generation.
  • refinementSteps (integer, optional): Steps for refining the image.
  • highNoiseFraction (number, default: 0.8): Fraction of noise for expert ensemble refiner.
  • numInferenceSteps (integer, default: 50): Total denoising steps during generation.
  • disableSafetyChecker (boolean, default: false): Option to disable safety checker for generated images.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "dibujo estilo Liniers a color de una nena pequeña (pelo rubio, dos colita, vestido rosa) jugando con un Trex verde",
  "loraScale": 0.6,
  "outputCount": 2,
  "refineStyle": "no_refiner",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "schedulingType": "K_EULER",
  "highNoiseFraction": 0.8,
  "numInferenceSteps": 50
}

Output

Upon successful execution, the action returns an array of image URLs representing the generated drawings. For example:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/b4e41101-3cc1-4b24-9d1f-22da0a70d07a/9654af76-8f66-44ef-8971-bcb7db74891e.png",
  "https://assets.cognitiveactions.com/invocations/b4e41101-3cc1-4b24-9d1f-22da0a70d07a/f08afdbf-693c-490d-9304-5b4c3d0b2bf5.png"
]

Conceptual Usage Example (Python)

Here's how you might call the Generate Liniers Style Drawing 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 = "dc9372bb-ae16-461a-af92-741bb8a0e287" # Action ID for Generate Liniers Style Drawing

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "dibujo estilo Liniers a color de una nena pequeña (pelo rubio, dos colita, vestido rosa) jugando con un Trex verde",
    "loraScale": 0.6,
    "outputCount": 2,
    "refineStyle": "no_refiner",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "schedulingType": "K_EULER",
    "highNoiseFraction": 0.8,
    "numInferenceSteps": 50
}

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 code snippet, you'll notice that the action ID and input payload are structured correctly to match the action's requirements. The endpoint URL and request structure are illustrative and should be adjusted according to your specific implementation.

Conclusion

The chukososa/estilo-liniers Cognitive Actions provide a fantastic opportunity for developers to integrate unique, artistic image generation capabilities into their applications. By leveraging the Generate Liniers Style Drawing action, you can easily create vibrant images that reflect the playful essence of Liniers’ artistic style. Explore various use cases, from enhancing digital art projects to generating engaging content for social media. Start creating and unleash your creativity today!