Create Stunning Art with Goya-Inspired Image Generation Using Cognitive Actions

23 Apr 2025
Create Stunning Art with Goya-Inspired Image Generation Using Cognitive Actions

In the realm of creativity and technology, the fofr/flux-goya-black-painting API brings a unique twist to image generation. By leveraging the power of Cognitive Actions, developers can create images fine-tuned on the 14 black paintings by Goya. This API provides pre-built actions that simplify the process of generating captivating artwork, allowing for customizations in dimensions, quality, and stylistic elements. Whether you're building an art application, a gallery display, or an educational tool, these actions can enrich your project with visually stunning outputs.

Prerequisites

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

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Familiarity with JSON as the input and output format for the actions.
  • An understanding of how to send HTTP requests (though the specifics of HTTP methods are abstracted in our discussion).

Authentication typically involves passing your API key in the request headers to access the Cognitive Actions functionalities seamlessly.

Cognitive Actions Overview

Generate Goya Inspired Images

The Generate Goya Inspired Images action creates images inspired by Goya's renowned black paintings, allowing developers to craft unique artistic interpretations based on textual prompts. This action falls under the image-generation category and offers various customization options, including image dimensions, quality, and guidance parameters.

Input

The input schema for this action requires the following:

  • prompt (required): A textual description to guide image generation. For example, a moody GOYA_BLK_PAINTING portrait painting of a gnarly man.
  • goFast (optional): A boolean to enable faster predictions.
  • loraScale (optional): A numeric value indicating the intensity of the main LoRA application.
  • modelType (optional): Choose between the dev or schnell model for inference.
  • numOutputs (optional): Specifies the number of images to generate (default is 1).
  • imageFormat (optional): The desired format for output images (e.g., webp, jpg, png).
  • guidanceScale (optional): Controls guidance during the diffusion process.
  • outputQuality (optional): Defines the quality of the output image.
  • promptStrength (optional): Strength of the prompt in image transformations.
  • imageAspectRatio (optional): Specifies the aspect ratio for the generated image.
  • numInferenceSteps (optional): Defines the number of denoising steps.

Example Input:

{
  "goFast": false,
  "prompt": "a moody GOYA_BLK_PAINTING portrait painting of a gnarly man",
  "loraScale": 1,
  "modelType": "dev",
  "numOutputs": 1,
  "imageFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "imageResolution": "1",
  "imageAspectRatio": "3:2",
  "numInferenceSteps": 28
}

Output

The output of this action typically returns a list of image URLs generated based on the specified prompt and parameters.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/f34bbd2d-796a-4004-abef-138a95061366/3c66ca40-fe26-4bca-bbed-716b32dc6539.webp"
]

Conceptual Usage Example (Python)

Here’s a concise Python code snippet demonstrating how to invoke the action:

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 = "16604d4b-2ab9-4503-9e6c-95234dc1f14b" # Action ID for Generate Goya Inspired Images

# Construct the input payload based on the action's requirements
payload = {
    "goFast": False,
    "prompt": "a moody GOYA_BLK_PAINTING portrait painting of a gnarly man",
    "loraScale": 1,
    "modelType": "dev",
    "numOutputs": 1,
    "imageFormat": "webp",
    "guidanceScale": 3,
    "outputQuality": 80,
    "extraLoraScale": 1,
    "promptStrength": 0.8,
    "imageAspectRatio": "3:2",
    "numInferenceSteps": 28
}

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.
  • The action_id corresponds to the Generate Goya Inspired Images action.
  • The payload structure adheres to the required input schema.

Conclusion

The Generate Goya Inspired Images action opens up a world of possibilities for developers looking to integrate advanced image generation capabilities into their applications. With customizable parameters and intuitive input formats, building visually compelling artwork has never been easier. Explore the creativity this action can bring to your projects, and consider integrating it for immersive user experiences!