Create Stunning Custom Images with Craisee2 Cognitive Actions

25 Apr 2025
Create Stunning Custom Images with Craisee2 Cognitive Actions

Craisee2 is a powerful service designed for developers looking to elevate their applications with advanced image generation capabilities. With its Cognitive Actions, Craisee2 enables you to produce high-quality images based on user-defined prompts. This service offers a range of customization options, including inpainting, fast generation modes, and various settings for image quality and aspect ratios. Whether you're working on creative projects, generating marketing materials, or enhancing user experiences, Craisee2 simplifies the process of image creation, allowing you to focus on your core application logic while leveraging sophisticated AI technology.

Imagine being able to generate unique images tailored to specific themes or concepts with just a few lines of code. Craisee2 caters to a variety of use cases, such as:

  • Marketing and Advertising: Quickly create visually appealing graphics that align with your brand messaging.
  • Creative Projects: Artists and designers can use the service to visualize concepts without the need for extensive graphic design skills.
  • E-commerce: Generate product images or promotional banners that attract customer attention.
  • Game Development: Create unique textures and backgrounds that enhance the gaming experience.

To get started, all you need is a valid Cognitive Actions API key and a fundamental understanding of making API calls.

Generate Enhanced Images with Customization

The "Generate Enhanced Images with Customization" action is designed to produce high-quality images based on detailed user prompts. This action solves the problem of generating tailored visual content, allowing users to specify various parameters that influence the output image's aesthetic and quality.

Input Requirements

The input for this action includes several parameters, but the most critical is the prompt, which is a descriptive text that guides the image generation. Other optional parameters include:

  • mask: A URI to an image mask for inpainting.
  • seed: An integer for random seed generation.
  • image: A URI to an input image for image-to-image transformations.
  • width & height: Dimensions for custom aspect ratios.
  • imageFormat: The output image format (webp, jpg, png).
  • inferenceSteps: The number of denoising steps for generating the image.
  • numberOfOutputs: How many images to generate.

Expected Output

The output will be a set of generated image URLs that correspond to the specifications provided in the input. Each image will reflect the prompt and customization settings applied during generation.

Use Cases for this specific action

This action is particularly useful when you need to:

  • Create personalized content: Generate images that resonate with specific themes or messages.
  • Experiment with styles: Test different artistic styles and visual elements without needing extensive resources.
  • Save time in design workflows: Quickly produce images that can be further refined or used as-is in applications.
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "392645ae-02ab-4907-b4a2-296dc26dd667" # Action ID for: Generate Enhanced Images with Customization

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "prompt": "a surreal collage blue blackground in the style of CRAISEE",
  "imageFormat": "webp",
  "promptImpact": 0.8,
  "loraIntensity": 1,
  "executionModel": "dev",
  "inferenceSteps": 28,
  "numberOfOutputs": 4,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 3.5,
  "outputImageQuality": 90,
  "additionalLoraIntensity": 1
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    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 (non-JSON): {e.response.text}")
    print("------------------------------------------------")

Conclusion

Craisee2's image generation capabilities empower developers to create stunning, customized visuals effortlessly. By leveraging the "Generate Enhanced Images with Customization" action, you can enhance your applications with unique images tailored to your users' needs. The flexibility and variety of options available make it ideal for various industries, from marketing to creative arts.

To begin integrating this powerful tool into your projects, explore the API documentation, set up your API key, and start experimenting with the numerous customization options available. The potential for creativity is at your fingertips with Craisee2!