Create Stunning Images with jbilcke/sdxl-tombraider Cognitive Actions

In the realm of image generation, the jbilcke/sdxl-tombraider API offers powerful Cognitive Actions that allow developers to create captivating visuals inspired by the iconic Tomb Raider (1996) video game. By leveraging the SDXL LoRA model, these actions enable a range of customizations and refinements to enhance image quality, making it an essential tool for any developer looking to incorporate advanced image generation into their applications.
Prerequisites
Before diving into the implementation of Cognitive Actions, you'll need to ensure you have the necessary requirements in place:
- API Key: You will need a valid API key to authenticate your requests.
- Setup: Familiarity with making API calls and handling JSON payloads is beneficial.
Authentication typically involves including your API key in the request headers, allowing you to access the features of the Cognitive Actions platform securely.
Cognitive Actions Overview
Generate Image with SDXL Tomb Raider Style
This action allows you to create visually stunning images using the SDXL LoRA model, inspired by the Tomb Raider aesthetic. You can customize various parameters to refine the image generation process.
Input
The input for this action is a structured JSON object that includes several properties. Below is the detailed schema along with an example input:
{
"width": 1024,
"height": 1024,
"prompt": "Lara driving a car in Paris, in the style of TOK",
"refine": "no_refiner",
"loraScale": 0.85,
"scheduler": "K_EULER",
"guidanceScale": 18.25,
"applyWatermark": true,
"negativePrompt": "overexposed",
"promptStrength": 0.8,
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 50
}
Fields:
width: (integer) The width of the output image in pixels (default: 1024).height: (integer) The height of the output image in pixels (default: 1024).prompt: (string) A description of the desired image content.refine: (string) Specifies the style of refinement to use.loraScale: (number) LoRA additive scale factor (0 to 1).scheduler: (string) Type of scheduler to use for image generation.guidanceScale: (number) Classifier-free guidance scale (1 to 50).applyWatermark: (boolean) Whether to apply a watermark to the generated image.negativePrompt: (string) Input for negative prompts.promptStrength: (number) Strength of the prompt for img2img or inpainting.numberOfOutputs: (integer) Number of images to generate (1 to 4).highNoiseFraction: (number) Fraction of high noise for refinement.numberOfInferenceSteps: (integer) Number of denoising steps (1 to 500).
Output
This action typically returns a URL to the generated image. Here’s an example output:
[
"https://assets.cognitiveactions.com/invocations/64affe09-1bd6-47fd-ac18-909edda4d7e5/05ed1f61-aa29-4560-913c-6ad1fd10ee6b.png"
]
Conceptual Usage Example (Python)
Below is a conceptual example of how to invoke the "Generate Image with SDXL Tomb Raider Style" action using Python:
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 = "ef11988d-6a08-47a7-9ecc-f39a145b6056" # Action ID for Generate Image with SDXL Tomb Raider Style
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 1024,
"prompt": "Lara driving a car in Paris, in the style of TOK",
"refine": "no_refiner",
"loraScale": 0.85,
"scheduler": "K_EULER",
"guidanceScale": 18.25,
"applyWatermark": True,
"negativePrompt": "overexposed",
"promptStrength": 0.8,
"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
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, you will replace the placeholder API key and endpoint with your actual credentials. The payload is constructed based on the required input fields for the action, and the response will include the URL to your generated image.
Conclusion
The jbilcke/sdxl-tombraider Cognitive Actions provide an exciting opportunity for developers to create unique and visually stunning images. With a range of customizable options, these actions can significantly enhance your applications' capabilities. Explore how you can integrate these actions into your projects and unleash the creative potential of AI-driven image generation.