Create Stunning Art with the dmitru/sdxl-nino Cognitive Actions

In the world of AI and creative design, the dmitru/sdxl-nino Cognitive Actions offer developers a powerful tool for generating art-inspired images. By leveraging advanced algorithms fine-tuned by artists, these actions allow you to create visually stunning images that can be customized to fit your unique vision. Whether you're looking to create stunning visuals for a project or explore the boundaries of AI-generated art, these pre-built actions simplify the process and save you development time.
Prerequisites
Before diving into the Cognitive Actions, you'll need a few essentials:
- API Key: Obtain your Cognitive Actions API key to authenticate your requests.
- Basic Setup: Ensure you have a working environment for making HTTP requests, such as Python with the
requestslibrary.
Authentication typically involves passing the API key in the headers of your requests, ensuring secure access to the actions.
Cognitive Actions Overview
Generate Art-Inspired Images
Description: This action allows you to create visually stunning images based on a specified prompt, with options for customization, including dimensions, refinement styles, and image inpainting. It provides the flexibility to control every aspect of the image generation process.
Category: Image Generation
Input
The action requires a structured JSON payload. Here’s a breakdown of the input schema:
- prompt (string): The creative prompt for image generation (e.g., "a painting in the style of TOK. An imagined magic animal with human face staring at me").
- width (integer): Width of the output image in pixels (default: 1024).
- height (integer): Height of the output image in pixels (default: 1024).
- refineStyle (string): Selects the style of refinement (default: "no_refiner").
- additiveScale (number): Scale for LoRA additive adjustments (default: 0.6).
- guidanceLevel (number): Weight for classifier-free guidance during generation (default: 7.5).
- applyWatermark (boolean): Determines if a watermark is applied (default: true).
- negativePrompt (string): Specifies undesirable features to avoid (default: "").
- promptStrength (number): Strength of the prompt when using img2img or inpainting mode (default: 0.8).
- numberOfOutputs (integer): Number of image outputs to generate (default: 1, range: 1-4).
- schedulingMethod (string): Method used for scheduling image generation steps (default: "K_EULER").
- highNoiseFraction (number): Fraction of noise used by expert_ensemble_refiner (default: 0.8).
- inferenceStepCount (integer): Total number of denoising steps (default: 50).
Example Input:
{
"width": 1024,
"height": 1024,
"prompt": "a painting in the style of TOK. An imagined magic animal with human face staring at me",
"refineStyle": "expert_ensemble_refiner",
"additiveScale": 0.84,
"guidanceLevel": 7.5,
"applyWatermark": true,
"negativePrompt": "",
"promptStrength": 0.8,
"numberOfOutputs": 3,
"schedulingMethod": "K_EULER",
"highNoiseFraction": 0.9,
"inferenceStepCount": 50
}
Output
The action typically returns an array of URLs pointing to the generated images. Here are some example outputs:
Example Output:
[
"https://assets.cognitiveactions.com/invocations/7c874889-9740-4b6e-8c67-be1d4fbf9604/3df81ccc-6a08-4a72-b7bf-ab688cb1d38a.png",
"https://assets.cognitiveactions.com/invocations/7c874889-9740-4b6e-8c67-be1d4fbf9604/6404a7af-c0b0-4845-bb0c-90c0bf6b4425.png",
"https://assets.cognitiveactions.com/invocations/7c874889-9740-4b6e-8c67-be1d4fbf9604/2b76c9ea-431b-4b54-845b-ea572baca5d2.png"
]
Conceptual Usage Example (Python)
Here’s how you could structure a Python request to execute this 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 = "597c59d3-a4ed-421a-8f50-b21fc0fa3f3f" # Action ID for Generate Art-Inspired Images
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "a painting in the style of TOK. An imagined magic animal with human face staring at me",
"refineStyle": "expert_ensemble_refiner",
"additiveScale": 0.84,
"guidanceLevel": 7.5,
"applyWatermark": True,
"negativePrompt": "",
"promptStrength": 0.8,
"numberOfOutputs": 3,
"schedulingMethod": "K_EULER",
"highNoiseFraction": 0.9,
"inferenceStepCount": 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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id should be the ID associated with the "Generate Art-Inspired Images" action. The payload is constructed to match the input schema requirements.
Conclusion
The dmitru/sdxl-nino Cognitive Actions provide developers with robust capabilities for generating art-inspired images tailored to specific needs. With options for customization and refinement, these actions can be integrated into various applications, enhancing creativity and visual appeal. As you explore these features, consider experimenting with different prompts and settings to discover the full potential of AI-generated art. Happy coding!