Generate Stunning Images with the Nebul.Redmond Cognitive Action

25 Apr 2025
Generate Stunning Images with the Nebul.Redmond Cognitive Action

In the realm of AI and machine learning, image generation has taken center stage, allowing developers to create stunning visuals with just a few lines of code. The Nebul.Redmond Cognitive Actions provide a powerful API for generating artistic and realistic images using a fine-tuned model based on Stable Diffusion SD XL 1.0. Whether you need images of cars, people, or abstract concepts, this model excels in versatility and quality. By leveraging these pre-built actions, developers can save time and effort while integrating sophisticated image generation capabilities into their applications.

Prerequisites

Before you start using the Nebul.Redmond Cognitive Actions, ensure you have:

  • An API key from the Cognitive Actions platform.
  • Basic familiarity with making API requests and handling JSON data.

To authenticate your requests, you'll typically pass your API key in the headers of your API call, allowing you to access the actions provided by the platform.

Cognitive Actions Overview

Generate Images with Nebul.Redmond Model

The Generate Images with Nebul.Redmond Model action allows you to create images based on specified prompts and parameters. It provides a range of settings to customize the output, ensuring you can tailor the generated images to your requirements.

Input

The input schema for this action consists of several fields, each serving a specific purpose:

  • seed (integer, optional): Seed value for random number generation. Leave blank for a random seed.
  • width (integer, optional): Width of the output image in pixels. Default is 1024.
  • height (integer, optional): Height of the output image in pixels. Default is 1024.
  • prompt (string, required): Text prompt that guides the image generation process. Provide descriptive and detailed input for best results.
  • scheduler (string, optional): Algorithm used for scheduling the denoising process. Default is "K_EULER".
  • guidanceScale (number, optional): Scale used for classifier-free guidance. Range is 1 to 20, with a default value of 7.5.
  • applyWatermark (boolean, optional): Determines whether a watermark is applied to the generated image. Default is true.
  • negativePrompt (string, optional): Negative prompt to steer the model away from certain undesirable characteristics.
  • numberOfOutputs (integer, optional): Specifies how many images to generate per request. Default is 1 (maximum is 4).
  • disableSafetyChecker (boolean, optional): Allows bypassing the safety checker for the generated images.
  • numberOfInferenceSteps (integer, optional): Specifies the number of denoising inference steps. Default is 40.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "masterpiece, high quality, ultra good, this is the good stuff, best prompt ever, portrait of a woman, freckles, ginger",
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "long torso, tall, bad quality, worst quality, normal quality, elderly, old, granny, 3d, sfm, text, watermark, low-quality, signature, moiré pattern, downsampling, distorted, blurry, glossy, blur, jpeg artifacts, compression artifacts, poorly drawn, low-resolution, bad, distortion, twisted, excessive, exaggerated pose, exaggerated limbs, grainy, symmetrical, duplicate, error, pattern, beginner, pixelated, fake, hyper, glitch, overexposed, high-contrast, bad-contrast",
  "numberOfOutputs": 1,
  "numberOfInferenceSteps": 40
}

Output

The action typically returns a list of URLs pointing to the generated images. Each URL links to a unique image produced based on your specified prompt and settings.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/51ea4ed4-18d4-4016-8c75-c484c2d0eaa9/d5240ff7-6595-4c7b-a2ae-0d9e14b7d642.png"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how a developer might call the Nebul.Redmond Cognitive Action to generate images:

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 = "27b6334a-f58d-4673-8f8b-5a9e3614fabf"  # Action ID for Generate Images with Nebul.Redmond Model

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "masterpiece, high quality, ultra good, this is the good stuff, best prompt ever, portrait of a woman, freckles, ginger",
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "long torso, tall, bad quality, worst quality, normal quality, elderly, old, granny, 3d, sfm, text, watermark, low-quality, signature, moiré pattern, downsampling, distorted, blurry, glossy, blur, jpeg artifacts, compression artifacts, poorly drawn, low-resolution, bad, distortion, twisted, excessive, exaggerated pose, exaggerated limbs, grainy, symmetrical, duplicate, error, pattern, beginner, pixelated, fake, hyper, glitch, overexposed, high-contrast, bad-contrast",
    "numberOfOutputs": 1,
    "numberOfInferenceSteps": 40
}

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:

  • Replace the COGNITIVE_ACTIONS_API_KEY and COGNITIVE_ACTIONS_EXECUTE_URL with your actual API key and endpoint.
  • The action_id corresponds to the "Generate Images with Nebul.Redmond Model".
  • The payload is structured according to the input schema, ensuring you provide all necessary parameters.

Conclusion

The Nebul.Redmond Cognitive Action offers developers a robust tool for generating high-quality images with ease. By understanding the action's input requirements and output structure, you can quickly integrate this functionality into your applications. With its flexibility and power, the potential use cases are vast—from creating artwork and illustrations to enhancing user-generated content. Start exploring the possibilities today!