Create Stunning Underwater Marine Life Images with Aolaru Cognitive Actions

23 Apr 2025
Create Stunning Underwater Marine Life Images with Aolaru Cognitive Actions

The Aolaru/Underwater-Life Cognitive Actions API provides developers with powerful tools to generate vivid and realistic images of underwater marine life. By leveraging advanced AI models, these pre-built actions empower you to create dynamic visual content with customizable options, enhancing your applications with stunning imagery. Whether you're building a game, an educational tool, or a visual art project, these actions can significantly elevate your user experience.

Prerequisites

Before you dive into integrating the Cognitive Actions, ensure you have the following:

  • An API key for the Aolaru Cognitive Actions platform. You'll need to include this key in the headers of your API requests for authentication.
  • Basic knowledge of JSON and making HTTP requests in your preferred programming language.

To authenticate, you will typically include the API key in the headers of your requests, as shown in the conceptual Python examples below.

Cognitive Actions Overview

Generate Underwater Marine Life Images

The Generate Underwater Marine Life Images action allows you to create vivid and detailed images of underwater scenes, such as marine life and coral environments. This action supports various customization options, including different generation modes, sizes, and output formats.

Input

The input for this action requires a structured JSON object containing several properties:

{
  "prompt": "man swimming underwater together with dolphins and corals ULG1",
  "loraScale": 1,
  "outputCount": 1,
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "deNoisingSteps": 28,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageAspectRatio": "1:1",
  "additionalLoraScale": 1
}
  • Required: prompt
  • Optional: mask, seed, image, width, height, loraScale, outputCount, modelWeights, outputFormat, guidanceScale, outputQuality, deNoisingSteps, inferenceModel, promptStrength, imageMegapixels, imageAspectRatio, acceleratePrediction, deactivateSafetyChecker, additionalLoraScale, additionalLoraWeights

Output

Upon successful execution, the action returns a URL pointing to the generated image:

[
  "https://assets.cognitiveactions.com/invocations/28799bd6-a3ab-497e-9e9d-16bb7206e8c2/0673e70c-1da9-4597-96a4-4afd9d4bdb88.webp"
]

This output is an array of URLs, each corresponding to an image generated based on your input specifications.

Conceptual Usage Example (Python)

Here’s how you might use the Generate Underwater Marine Life Images action in 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 = "d97bb228-4c1f-4bfd-bbe9-c170868a7fcf"  # Action ID for Generate Underwater Marine Life Images

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "man swimming underwater together with dolphins and corals ULG1",
    "loraScale": 1,
    "outputCount": 1,
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "deNoisingSteps": 28,
    "inferenceModel": "dev",
    "promptStrength": 0.8,
    "imageAspectRatio": "1:1",
    "additionalLoraScale": 1
}

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 Underwater Marine Life Images action.
  • The payload is structured according to the required input fields for the action.

Conclusion

The Aolaru Cognitive Actions API provides a powerful way to generate stunning underwater marine life images, giving developers the tools they need to create engaging visual experiences. By understanding the input requirements and leveraging the provided examples, you can seamlessly integrate these actions into your applications. Explore the possibilities and start creating breathtaking images that capture the beauty of underwater life today!