Create Stunning Images with the roblig7/luciana Cognitive Actions

In the world of AI-driven creativity, the roblig7/luciana Cognitive Actions empower developers to generate and manipulate images with ease. This set of pre-built actions allows for advanced image generation and inpainting, giving you the flexibility to create visually stunning content tailored to your needs. With adjustable attributes like image dimensions, aspect ratios, and model selection, these actions streamline the creative process for applications in various domains such as art, design, and marketing.
Prerequisites
Before diving into the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Basic knowledge of JSON and how to make HTTP requests in your preferred programming language.
Authentication typically involves passing your API key in the request headers, ensuring secure access to the actions.
Cognitive Actions Overview
Generate Image with Mask and Inpainting
The Generate Image with Mask and Inpainting action is designed to create images based on a specified prompt and optional inpainting using a mask URI. This action is ideal for developers looking to produce customized images or edit existing ones by defining specific areas for alteration.
Input
The input for this action is structured as follows:
{
"model": "dev",
"prompt": "Luciana wearing Wayfarer Sunglasses, walking in New York, smile",
"aspectRatio": "1:1",
"outputCount": 1,
"outputFormat": "webp",
"loraIntensity": 1,
"outputQuality": 90,
"promptStrength": 0.8,
"inferenceStepCount": 28,
"diffusionGuidanceScale": 3.5,
"additionalLoraIntensity": 1
}
- Required Fields:
prompt: A descriptive text that guides the image generation.
- Optional Fields:
model: Selects the model for inference (e.g., "dev", "schnell").aspectRatio: Determines the aspect ratio of the generated image.outputCount: Specifies the number of images to generate (1 to 4).outputFormat: Defines the format of the output images (e.g., "webp", "jpg", "png").loraIntensity: Influences the strength of the main LoRA applied.outputQuality: Sets the quality of the output images from 0 to 100.promptStrength: Adjusts the strength of the prompt when using img2img.inferenceStepCount: Determines the number of denoising steps for detail.diffusionGuidanceScale: Regulates the guidance scale for the diffusion process.additionalLoraIntensity: Controls the intensity of extra LoRA.
Output
Upon successful execution, the action returns a URL pointing to the generated image, like this:
[
"https://assets.cognitiveactions.com/invocations/f03521d4-7520-40d3-9996-8b4503f700ca/4526a9cf-4813-4c0c-bae9-6f5fa3ed5e52.webp"
]
The output is a direct link to the created image in the specified format.
Conceptual Usage Example (Python)
Here’s a conceptual example of how a developer might invoke the Generate Image with Mask and Inpainting 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 = "63422ee0-61f2-42fa-bdd6-0a304cedced7" # Action ID for Generate Image with Mask and Inpainting
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "Luciana wearing Wayfarer Sunglasses, walking in New York, smile",
"aspectRatio": "1:1",
"outputCount": 1,
"outputFormat": "webp",
"loraIntensity": 1,
"outputQuality": 90,
"promptStrength": 0.8,
"inferenceStepCount": 28,
"diffusionGuidanceScale": 3.5,
"additionalLoraIntensity": 1
}
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 payload is structured according to the action's requirements, allowing you to customize your image generation requests.
Conclusion
The roblig7/luciana Cognitive Actions provide developers with powerful tools for image generation and manipulation. By leveraging the options available, you can create tailored visual content for various applications, enhancing user engagement and creativity. Next, consider exploring additional use cases or integrating more actions to boost your application's capabilities further!