Generate Stunning Images with the Zelenioncode UIAI Cognitive Actions

23 Apr 2025
Generate Stunning Images with the Zelenioncode UIAI Cognitive Actions

Creating compelling visuals from textual descriptions has never been easier, thanks to the Zelenioncode UIAI Cognitive Actions. This set of actions leverages advanced models to bring your ideas to life through image generation. Whether you’re building an app that requires dynamic visuals or simply want to experiment with AI-generated images, these pre-built actions offer a streamlined solution for developers.

Prerequisites

Before you can begin using the Cognitive Actions, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of making API requests in your preferred programming language.

To authenticate your requests, you will typically pass your API key in the headers of your requests, ensuring secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Picture with RealVisXL3

The Generate Picture with RealVisXL3 action allows you to create high-quality images based on descriptive text prompts. This action falls under the category of image-generation and is ideal for applications that require visual content creation.

Input

The input for this action requires a single property:

  • prompt (string): A descriptive text prompt used to guide the image generation process. The default example provided is "Big robot in an empty modern city".

Example Input:

{
  "prompt": "Big robot in a empty modern city"
}

Output

Upon successful execution, this action returns a URL pointing to the generated image. The output is a direct link to the visual content created from your prompt.

Example Output:

https://assets.cognitiveactions.com/invocations/33136ec5-1f43-442c-89bf-38895f946413/1f50a999-ebdb-4c1e-a393-084cdd676cd2.png

Conceptual Usage Example (Python)

Here's how you might call the Generate Picture with RealVisXL3 action using Python. This code snippet illustrates how to structure the input payload and make the request to the Cognitive Actions endpoint.

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 = "d293cd6b-2bc6-4bb3-89de-a7fa783bf510" # Action ID for Generate Picture with RealVisXL3

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "Big robot in a empty modern city"
}

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 example, the action ID and input payload are clearly defined. The endpoint URL and request structure are illustrative, so make sure to replace them with the actual values as per your integration needs.

Conclusion

The Zelenioncode UIAI Cognitive Actions empower developers to easily integrate image generation capabilities into their applications. By leveraging the Generate Picture with RealVisXL3 action, you can create visually appealing content that enhances user experience. Start experimenting with these actions today and unlock the potential of AI-driven creativity in your projects!