Create Stunning Images with Custom Parameters Using Whiteclaw Sdxl

In the realm of image generation, Whiteclaw Sdxl stands out by offering developers powerful tools to create customized images tailored to their specific needs. By leveraging Cognitive Actions, you can seamlessly generate images with unique parameters that suit a variety of applications. Whether you're looking to create artwork, enhance existing images, or develop visual content for marketing, this service simplifies the process while saving you time and resources.
Imagine having the ability to generate images that fit your exact specifications, whether it's for game design, social media, or e-commerce. The versatility of the Whiteclaw Sdxl Cognitive Actions allows you to customize everything from the dimensions and style to the underlying algorithms that drive the image creation process. This flexibility opens up a world of possibilities, making it an ideal solution for developers across different industries.
Prerequisites
To get started with Whiteclaw Sdxl, you will need a Cognitive Actions API key and a basic understanding of how to make API calls. This will enable you to integrate the image generation capabilities into your applications seamlessly.
Generate Image with Custom Parameters
The "Generate Image with Custom Parameters" action is designed to create an image using either inpaint or img2img mode, offering various customizable parameters to enhance the output. This action is particularly useful for developers looking to refine or modify existing images or create entirely new visuals based on text prompts.
Purpose
This action solves the problem of needing customized images that can be generated quickly and efficiently. By allowing for detailed adjustments, developers can produce high-quality visuals that meet specific project requirements.
Input Requirements
The input for this action requires a structured object containing various properties:
- Mask: URI of the input mask used in inpaint mode.
- Seed: An integer defining the random seed for image generation.
- Image: URI of the input image for img2img or inpaint mode processing.
- Width: Specifies the output image width (default is 1024 pixels).
- Height: Specifies the output image height (default is 1024 pixels).
- Prompt: Text that guides the image generation (default is "An astronaut riding a rainbow unicorn").
- Refine Type: Determines the refinement style (options include "no_refiner", "expert_ensemble_refiner", or "base_image_refiner").
- Scheduler Type: Specifies the algorithm for image generation (default is "K_EULER").
- Apply Watermark: Boolean to determine if a watermark is included in the image.
- Number of Outputs: Specifies how many images to generate (1 to 4).
- Prompt Intensity: Defines the strength of the prompt.
- Refinement Steps: Number of steps for image refinement.
- High Noise Fraction: Fraction of noise for the refinement process.
- Lora Additive Scale: Scale for LoRA, applicable to trained models.
- Guidance Scale Value: Scale for classifier-free guidance.
- Negative Prompt: Text for undesired elements in the image.
- Disable Safety Checker: Boolean to disable the safety checker.
- Number of Inference Steps: Denoising steps in the image generation process.
Expected Output
The expected output is a URI link to the generated image, which can be used directly in applications or for further processing.
Use Cases for this Action
- Art and Design: Generate unique artwork for digital galleries or personal projects.
- Marketing: Create tailored images for social media posts, advertisements, or product listings.
- Game Development: Design characters or environments based on specific prompts and styles.
- Content Creation: Produce images for blogs, articles, or tutorials that require custom visuals.
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 = "44b2c096-d52e-4d52-bbf0-2471f285e4ed" # Action ID for: Generate Image with Custom Parameters
# 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": "A photo of a TOK",
"refineType": "no_refiner",
"scheduleType": "K_EULER",
"applyWatermark": true,
"numberOfOutputs": 1,
"promptIntensity": 0.8,
"highNoiseFraction": 0.8,
"loraAdditiveScale": 0.6,
"guidanceScaleValue": 7.5,
"negativePromptInput": "",
"numberOfInferenceSteps": 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
Whiteclaw Sdxl offers a robust and flexible solution for developers seeking to enhance their applications with custom image generation capabilities. By utilizing the "Generate Image with Custom Parameters" action, you can create stunning visuals tailored to your specific needs, streamline your workflow, and bring your creative ideas to life. As you explore the possibilities, consider how these image generation features can elevate your projects and engage your audience in new ways. Start integrating these Cognitive Actions today and unlock the full potential of your visual content!