Create Stunning Dune-Inspired Images with omidaziz/sdxl-dune Cognitive Actions

In the world of digital creativity, the ability to generate captivating images can open up a plethora of possibilities. The omidaziz/sdxl-dune API offers powerful Cognitive Actions designed specifically for image generation inspired by the iconic film Dune. With features such as img2img transformations, inpainting, and various refinement styles, developers can harness these pre-built actions to create unique visuals that resonate with fans of the film and beyond.
Prerequisites
Before diving into the Cognitive Actions, ensure you have the following:
- An API key for accessing the Cognitive Actions platform.
- Basic knowledge of working with APIs and JSON.
- Familiarity with Python for conceptual implementation (although any language can be used).
Authentication typically involves passing your API key in the request headers to access the available actions.
Cognitive Actions Overview
Generate Dune-Style Images
The Generate Dune-Style Images action allows users to create images with a fine-tuned SDXL model based on Dune. Customize your output with various options for transformation and style refinement.
- Category: Image Generation
Input
The input schema for this action is a JSON object consisting of several fields:
- prompt (string): Text description to guide the image generation.
- width (integer): Desired width of the output image (default is 1024).
- height (integer): Desired height of the output image (default is 1024).
- loraScale (number, 0 to 1): Scale factor for LoRA models (default is 0.6).
- numOutputs (integer): Number of images to produce (1 to 4, default is 1).
- refineStyle (string): Method for image refinement (default is "no_refiner").
- guidanceScale (number, 1 to 50): Influences the balance between prompt and generated image (default is 7.5).
- applyWatermark (boolean): Whether to apply a watermark (default is true).
- negativePrompt (string): Attributes to avoid in the image.
- promptStrength (number, 0 to 1): Influence of the original image in img2img mode (default is 0.8).
- highNoiseFraction (number, 0 to 1): Specifies the fraction of noise for refinement (default is 0.8).
- numInferenceSteps (integer, 1 to 500): Number of denoising steps (default is 50).
- schedulingAlgorithm (string): Algorithm for step scheduling (default is "K_EULER").
Here’s an example of the input JSON payload:
{
"width": 1024,
"height": 1024,
"prompt": "In the style of TOK, a photo of a woman, dune, portrait, war, apocalyptic",
"loraScale": 0.5,
"numOutputs": 1,
"refineStyle": "no_refiner",
"guidanceScale": 7.5,
"applyWatermark": false,
"negativePrompt": "happy, cheerful, joyful, modern, traditional, fashionable, contemporary, progressive, religious, cartoon, underexposed, overexposed, low saturation, low resolution, low quality, pixelated, blurry, oversaturated, watermark, broken, distorted, disfigured, deformed, artifacts, ugly, mismatching eyes, ugly eyes, imperfect eyes, cross eyed, deformed pupils, deformed iris, deformed nose, ugly nose, poorly drawn face, poorly drawn hands, extra limbs, bad anatomy",
"promptStrength": 0.8,
"highNoiseFraction": 0.9,
"numInferenceSteps": 50,
"schedulingAlgorithm": "K_EULER"
}
Output
The output of this action is typically a list of image URLs generated based on the provided prompt and settings. Here’s an example of what you might receive:
[
"https://assets.cognitiveactions.com/invocations/d71a5345-b85b-4c81-8443-26a07c51d070/a68b960b-a924-4ec6-b97b-32c87434b330.png"
]
Conceptual Usage Example (Python)
Below is a conceptual Python code snippet demonstrating how to invoke the Generate Dune-Style Images action:
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 = "8fd68ec7-2f0d-4f25-8d17-98016e64cb65" # Action ID for Generate Dune-Style Images
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "In the style of TOK, a photo of a woman, dune, portrait, war, apocalyptic",
"loraScale": 0.5,
"numOutputs": 1,
"refineStyle": "no_refiner",
"guidanceScale": 7.5,
"applyWatermark": False,
"negativePrompt": "happy, cheerful, joyful, modern, traditional, fashionable, contemporary, progressive, religious, cartoon, underexposed, overexposed, low saturation, low resolution, low quality, pixelated, blurry, oversaturated, watermark, broken, distorted, deformed, artifacts, ugly, mismatching eyes, ugly eyes, imperfect eyes, cross eyed, deformed pupils, deformed iris, deformed nose, ugly nose, poorly drawn face, poorly drawn hands, extra limbs, bad anatomy",
"promptStrength": 0.8,
"highNoiseFraction": 0.9,
"numInferenceSteps": 50,
"schedulingAlgorithm": "K_EULER"
}
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 the code snippet above, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The action_id is set for the image generation action, and the input payload is structured according to the specifications.
Conclusion
The omidaziz/sdxl-dune Cognitive Actions provide an exciting opportunity for developers to create visually stunning images inspired by the cinematic world of Dune. By leveraging the power of image generation through the API, you can enhance your applications with unique visual content. Whether you’re aiming to generate realistic landscapes or imaginative portraits, these actions can be a valuable asset in your development toolkit. Explore the possibilities and bring your creative visions to life!