Transform Your Art with Museai's Image Generation Actions

26 Apr 2025
Transform Your Art with Museai's Image Generation Actions

Museai is an innovative service that leverages advanced Cognitive Actions to breathe new life into your artistic creations. With the power to generate stunning images influenced by the styles of the south of France, Museai simplifies and accelerates the process of artistic image creation. Whether you're an artist looking to expand your portfolio, a developer building creative applications, or a marketer in need of unique visuals, Museai provides a versatile and powerful solution.

Imagine you have a collection of oil paintings that you want to transform into captivating digital art. Museai allows you to customize the output by adjusting various parameters such as dimensions, refinement techniques, and more, ensuring that the final images meet your specific artistic vision. This service is perfect for professionals in the creative industry, social media managers seeking eye-catching content, and anyone looking to enhance their visual storytelling.

Prerequisites

To get started with Museai's Cognitive Actions, you'll need an API key and a basic understanding of making API calls.

Create Styled Image from Paintings

The "Create Styled Image from Paintings" action is designed to generate an image based on input oil paintings, applying stylistic influences from the picturesque landscapes of southern France. This action addresses the challenge of creating unique art pieces that maintain the essence of original paintings while introducing new artistic elements.

Input Requirements

To use this action, you must provide the following inputs:

  • Image: A URI pointing to the input image (the oil painting).
  • Mask: A URI for the input mask used in inpaint mode.
  • Width: The desired output image width in pixels (default is 1024).
  • Height: The desired output image height in pixels (default is 1024).
  • Prompt: A description of the desired characteristics of the output image (e.g., "in the style of TOK").
  • Refine: Specifies the refinement style to apply (options include no_refiner, expert_ensemble_refiner, base_image_refiner).
  • Guidance Scale: A numeric scale for classifier-free guidance (default is 7.5).
  • Negative Prompt: Elements to exclude from the output image, provided as a comma-separated string.
  • Number of Outputs: The number of images to generate (1 to 4).
  • Inference Steps Count: The number of denoising steps to perform (default is 50).

Expected Output

The output will be a URI to the generated image, showcasing your input painting transformed into a new artistic style.

Use Cases for this Specific Action

  • Artists: Enhance your portfolio by creating unique digital versions of your traditional artworks.
  • Content Creators: Generate distinctive visuals for blog posts, social media, or marketing materials, ensuring your content stands out.
  • Game Developers: Utilize this action to create beautiful background art or character designs inspired by classic styles.
  • E-commerce: Improve product presentation with stylized images that attract customer attention.
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 = "e39ba9f9-34c5-4e80-bf13-02efd19925e1" # Action ID for: Create Styled Image from Paintings

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 1024,
  "height": 1024,
  "prompt": "in the style of TOK",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "table, glass, fruit, plate , carafe, window",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "inferenceStepsCount": 50
}

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

Museai's image generation capabilities offer a powerful means to transform traditional art into modern digital masterpieces. With customizable options and the ability to generate images that reflect your unique vision, this service is an invaluable tool for anyone in the creative field. Whether you're looking to enhance your artistic portfolio, create engaging content, or develop visually appealing applications, Museai provides the tools you need to succeed. Start exploring the possibilities today and unlock a new realm of artistic expression!