Create Stunning Custom Images with Maya Hooo's AI Actions

27 Apr 2025
Create Stunning Custom Images with Maya Hooo's AI Actions

Maya Hooo offers powerful Cognitive Actions designed to simplify the image generation process, enabling developers to create custom styled images tailored to specific needs. By leveraging advanced AI models, users can produce high-quality images quickly and efficiently, making it an ideal solution for a variety of applications. Whether you are working in advertising, content creation, or simply looking to enhance your digital art, these actions provide the necessary tools to bring your ideas to life.

Common use cases include transforming existing images with unique styles, generating artwork based on detailed prompts, and creating visually appealing content for social media and marketing campaigns. With the ability to adjust various parameters, developers can fine-tune the image generation process to achieve the desired results, ensuring that every output aligns with their creative vision.

Prerequisites

To get started, you will need a Cognitive Actions API key and a basic understanding of making API calls.

Generate Custom Styled Images

This action allows you to produce custom images with adjustable styles utilizing either the 'dev' or 'schnell' models. It supports image-to-image transformations and inpainting, making it versatile for different artistic needs. The process is optimized for both quality and speed, depending on the chosen settings.

Input Requirements

The action requires a structured input comprising several parameters, with the most critical being the prompt, which guides the image generation. Other input options include:

  • mask: URI for the image mask used in inpainting mode.
  • image: URI of the input image for transformations.
  • model: Choose between 'dev' (28 inference steps) and 'schnell' (4 steps).
  • width, height: Dimensions of the generated image.
  • goFast: A boolean to enable faster predictions.
  • Additional parameters include guidanceScale, outputQuality, and more.

Expected Output

The output will be a URL linking to the generated image, formatted in the specified output format (e.g., PNG, JPG, WEBP).

Use Cases for this specific action

This action is perfect for:

  • Marketing and Advertising: Generate eye-catching visuals for promotional materials.
  • Social Media Content: Create unique images that stand out on platforms like Instagram or Facebook.
  • Personal Projects: Transform personal photos into stylized art pieces.
  • Game Development: Generate character designs or backgrounds based on specific prompts.

By utilizing the flexibility of the various parameters, developers can customize the image generation process to suit their specific requirements.

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 = "6499e841-1aef-4ccc-9175-f35f2e4eeca3" # Action ID for: Generate Custom Styled Images

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "seed": 28866,
  "model": "dev",
  "goFast": false,
  "prompt": "30 years old Maya-hoo wearing white Pakistani plan kurta and shalwar, standing on a road, looking into the camera. amused facial expressions. ",
  "loraScale": 1,
  "megapixels": "1",
  "numOutputs": 1,
  "aspectRatio": "1:1",
  "outputFormat": "png",
  "guidanceScale": 3,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numInferenceSteps": 28
}

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

Maya Hooo's Cognitive Actions for generating custom styled images provide developers with the tools needed to create high-quality visuals effortlessly. With the ability to adjust styles, formats, and generation speeds, these actions cater to a wide range of use cases, from marketing materials to personal artwork. The next step is to integrate these actions into your projects and explore the creative possibilities they unlock. Embrace the future of image generation with Maya Hooo and elevate your content to new heights!