Create Stunning Historical Illustrations with serkanh/mkataturk Cognitive Actions

23 Apr 2025
Create Stunning Historical Illustrations with serkanh/mkataturk Cognitive Actions

Integrating cognitive actions into your applications can elevate user experiences through advanced functionalities. The serkanh/mkataturk spec provides a powerful toolset designed for generating historically themed illustrations. This action leverages AI-driven enhancements to create visually captivating images based on user-defined prompts. By utilizing these pre-built actions, developers can save time and resources while focusing on their application's unique features.

Prerequisites

Before you start using the Cognitive Actions from the serkanh/mkataturk spec, ensure you have the following:

  • An API key for the Cognitive Actions platform, which will authenticate your requests.
  • Basic knowledge of JSON and HTTP requests, as interactions with the actions will involve constructing JSON payloads.

To authenticate, you will typically include your API key in the headers of your requests.

Cognitive Actions Overview

Generate Historical Illustration

The Generate Historical Illustration action allows you to create a historically themed image featuring a young MKATATURK in a military school setting. This action utilizes image inpainting techniques and enables customization through various parameters such as dimensions, aspect ratio, and output quality.

Input

The action requires the following fields in the input schema:

  • prompt (required): A detailed description of the scene to be illustrated.
  • goFast (optional): Enable fast predictions (default is false).
  • outputCount (optional): Number of images to generate (1-4).
  • guidanceScale (optional): Controls the influence of the prompt on the generated image.
  • outputQuality (optional): Determines the quality of saved output images.
  • inferenceModel (optional): Model to use for inference, default is "dev".
  • imageAspectRatio (optional): Sets the aspect ratio for the generated image.
  • imageOutputFormat (optional): Specifies the format of the output images.

Example Input:

{
  "goFast": false,
  "prompt": "Create a warm, engaging illustration depicting teenage MKATATURK as a dedicated student at military school...",
  "outputCount": 1,
  "guidanceScale": 3,
  "outputQuality": 80,
  "inferenceModel": "dev",
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "webp"
}

Output

The action typically returns a URL to the generated image. The output will contain the link to the illustration based on the provided prompt.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/fc9b1dd4-4a1f-4525-aa3a-0c370a819e82/b22fbe67-8072-43f2-bd47-f28110c312ab.webp"
]

Conceptual Usage Example (Python)

Here's how you might call the Generate Historical Illustration 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 = "7bc845a4-1823-4bf0-9a36-943f3d6fa1f4" # Action ID for Generate Historical Illustration

# Construct the input payload based on the action's requirements
payload = {
    "goFast": false,
    "prompt": "Create a warm, engaging illustration depicting teenage MKATATURK as a dedicated student at military school...",
    "outputCount": 1,
    "guidanceScale": 3,
    "outputQuality": 80,
    "inferenceModel": "dev",
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "webp"
}

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 the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The input payload is structured according to the requirements of the Generate Historical Illustration action. The example demonstrates how to send a POST request to the Cognitive Actions API and handle the response.

Conclusion

The serkanh/mkataturk Cognitive Actions enable developers to create rich, historically themed illustrations with ease. By leveraging the power of AI-generated imagery, you can enhance your applications with stunning visuals that engage users and bring stories to life. Explore various use cases for these actions, from educational tools to creative projects, and start integrating them into your applications today!