Create Whimsical Art with Cognitive Actions from copilot-us/maria-prymachenko

25 Apr 2025
Create Whimsical Art with Cognitive Actions from copilot-us/maria-prymachenko

In the world of AI-driven creativity, the "copilot-us/maria-prymachenko" Cognitive Actions enable developers to generate stunning, folk art-style images inspired by the vibrant works of Ukrainian artist Maria Prymachenko. These pre-built actions allow you to harness the power of artificial intelligence to create unique artworks that reflect traditional folklore and nature themes, all while saving time and effort in the creative process.

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 when making requests.
  • Basic knowledge of how to make API calls and handle JSON data.

To authenticate your requests, you will typically include your API key in the request headers as follows:

Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY

Cognitive Actions Overview

Generate Folk Art Style Images

Description:
This action generates whimsical and colorful artworks inspired by Maria Prymachenko's folk art style. It reflects the essence of traditional folklore and nature themes.

Category: image-generation

Input

The input schema for this action allows for a variety of customizable options:

  • mask (string, optional): Input mask for inpaint mode. Black areas will remain unaltered, white areas will be inpainted.
  • seed (integer, optional): Specifies the random seed for generating images. Leave empty to randomize the seed.
  • image (string, optional): URI for the input image used in 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"): Textual prompt used to generate the image.
  • refineStyle (string, default: "no_refiner"): Select which refinement style to apply.
  • customWeights (string, optional): Custom LoRA weights to be applied.
  • guidanceScale (number, default: 7.5): Controls the strength of classifier-free guidance (1 to 50).
  • schedulerType (string, default: "K_EULER"): Choose the scheduling algorithm for image generation.
  • applyWatermark (boolean, default: true): Determine whether a watermark is applied to the generated image.
  • promptStrength (number, default: 0.8): Strength of the prompt when using img2img or inpaint modes.
  • loraScaleFactor (number, default: 0.6): The scaling factor for LoRA application.
  • numberOfOutputs (integer, default: 1): Specifies how many images to generate (1 to 4).
  • highNoiseFraction (number, default: 0.8): Specifies the fraction of noise to use with the 'expert_ensemble_refiner'.
  • negativeInputPrompt (string, optional): A negative prompt to guide away from unwanted content.
  • safetyCheckerDisabled (boolean, default: false): Option to disable the safety checker for generated images.
  • numberOfInferenceSteps (integer, default: 50): Defines the number of denoising steps during image generation.
  • numberOfRefinementSteps (integer, optional): Specifies the number of refinement steps for 'base_image_refiner'.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A mythical cow with big sharp teeth in the night sky in the style of TOK.",
  "refineStyle": "no_refiner",
  "guidanceScale": 7.5,
  "schedulerType": "K_EULER",
  "applyWatermark": true,
  "promptStrength": 0.8,
  "loraScaleFactor": 0.6,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "negativeInputPrompt": "",
  "numberOfInferenceSteps": 50
}

Output

The action typically returns a URL pointing to the generated image. Here’s an example of what the output might look like:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/f6208521-0b73-49b5-9fa2-e8af1ec45a91/5fa68ccf-363a-4800-b702-201e9913bb71.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the "Generate Folk Art Style Images" 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 = "1f9a038d-9df8-4047-bfca-7b0a846bd953"  # Action ID for Generate Folk Art Style Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A mythical cow with big sharp teeth in the night sky in the style of TOK.",
    "refineStyle": "no_refiner",
    "guidanceScale": 7.5,
    "schedulerType": "K_EULER",
    "applyWatermark": True,
    "promptStrength": 0.8,
    "loraScaleFactor": 0.6,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8,
    "negativeInputPrompt": "",
    "numberOfInferenceSteps": 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 code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key and adjust the payload according to your desired output. The endpoint URL and request structure are illustrative, ensuring that you format your input payload correctly.

Conclusion

The Cognitive Actions under the "copilot-us/maria-prymachenko" specification present an exciting opportunity for developers to create unique artistic content programmatically. By leveraging these actions, you can explore a myriad of creative possibilities, from whimsical illustrations to complex folk art designs. As you integrate these capabilities into your applications, consider experimenting with different prompts and settings to discover the full range of artistic expressions available at your fingertips. Happy coding!