Create Stunning Street Art Murals with the SDXL Cognitive Actions

In today's digital landscape, the ability to generate unique and engaging visual content is essential for many applications. The hunterkamerman/sdxl-murals API offers a powerful set of Cognitive Actions designed for creating dynamic street art murals. Utilizing a fine-tuned SDXL LoRA model, developers can customize various parameters, ensuring high-quality and realistic outputs tailored to their creative needs. In this article, we will explore how to leverage these Cognitive Actions to bring vibrant street art to your applications.
Prerequisites
To get started with the Cognitive Actions provided by the hunterkamerman/sdxl-murals API, ensure you have the following:
- An API key for authenticating your requests to the Cognitive Actions platform.
- Basic knowledge of JSON and RESTful API interactions.
Typically, authentication involves passing your API key in the request headers, allowing you to securely access the API's functionality.
Cognitive Actions Overview
Generate Street Art Mural
The Generate Street Art Mural action is designed to create unique murals using a variety of customizable parameters. It allows for artistic flexibility through options like prompts, image dimensions, and refinement styles, making it ideal for developers looking to enhance their applications with visually captivating content.
Input
The input for this action requires a JSON object structured according to the following schema:
{
"mask": "http://example.com/mask.png", // Optional input mask for inpainting
"seed": 12345, // Optional random seed
"image": "http://example.com/image.png", // Optional image for img2img or inpaint
"width": 1024, // Output width in pixels
"height": 1024, // Output height in pixels
"prompt": "tok a street art mural of kim kardashian vibrant colors", // Main prompt for generation
"loraScale": 0.6, // Scale for LoRA layers
"loraWeights": "http://example.com/lora_weights", // Optional LoRA weights
"refineSteps": 10, // Optional refinement steps
"refineStyle": "no_refiner", // Refinement style
"guidanceScale": 7.5, // Guidance scale for generation
"applyWatermark": true, // Watermark application
"negativePrompt": "", // Negative prompt to suppress features
"promptStrength": 0.8, // Prompt strength for img2img
"scheduleMethod": "K_EULER", // Scheduler method for denoising
"numberOfOutputs": 1, // Number of images to generate
"highNoiseFraction": 0.8, // Noise fraction for refinement
"disableSafetyChecker": false, // Safety checker setting
"numberOfInferenceSteps": 50 // Number of inference steps
}
Example Input:
{
"width": 1024,
"height": 1024,
"prompt": "tok a street art mural of kim kardashian vibrant colors",
"loraScale": 0.6,
"refineStyle": "no_refiner",
"guidanceScale": 7.5,
"applyWatermark": true,
"negativePrompt": "",
"promptStrength": 0.8,
"scheduleMethod": "K_EULER",
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 50
}
Output
Upon successful execution of the action, the output will be a JSON array containing the URLs of the generated mural images.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/bdbfab99-bd63-4f2d-bde8-99bb39077436/7c9b47fe-b56b-40ab-9d1b-9e5430130df6.png"
]
Conceptual Usage Example (Python)
Here’s how you might call the Generate Street Art Mural action using Python. This example demonstrates how to structure the JSON payload properly:
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 = "87f5e397-22ca-4873-9e12-765bea7ef34a" # Action ID for Generate Street Art Mural
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "tok a street art mural of kim kardashian vibrant colors",
"loraScale": 0.6,
"refineStyle": "no_refiner",
"guidanceScale": 7.5,
"applyWatermark": True,
"negativePrompt": "",
"promptStrength": 0.8,
"scheduleMethod": "K_EULER",
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 50
}
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 payload variable contains the structured input required for the action, and the response will include the generated mural images.
Conclusion
Integrating the hunterkamerman/sdxl-murals Cognitive Actions into your applications allows you to create stunning and unique street art murals with ease. By customizing parameters such as prompts, dimensions, and refinement styles, you can enhance your projects with vibrant visuals that stand out. Explore the possibilities and consider how these actions could elevate your creative endeavors. Happy coding!