Generate Stunning Images with Inpainting using Cognitive Actions for Regina Aurore

In the realm of image generation, the biguloff/regina-aurore API offers an exciting capability through its Cognitive Action: Generate Image with Inpainting. This action leverages advanced models to produce detailed and ultrarealistic images, allowing developers to integrate sophisticated image generation features into their applications. With customizable parameters such as image masks, quality settings, and output formats, these pre-built actions enable developers to create powerful and flexible image generation solutions seamlessly.
Prerequisites
To get started with the Cognitive Actions for image generation, you will need:
- An API key for the Cognitive Actions platform. This key is required for authentication and should be included in the request headers when making API calls.
- Basic knowledge of JSON and Python to structure your requests and handle responses.
Cognitive Actions Overview
Generate Image with Inpainting
Purpose
This action generates images with inpainting capabilities, allowing for intricate and realistic image predictions. Developers can utilize custom image masks and adjust various parameters to achieve their desired results.
Input
The input for this action is structured as follows:
- prompt (required): A description of the image to be generated.
- mask (optional): An image mask for inpainting mode.
- seed (optional): An integer to set a random seed for reproducible results.
- image (optional): An input image for inpainting or image-to-image generation.
- model (optional): Choose between "dev" and "schnell" models for different performance characteristics.
- width (optional): Specifies the width of the generated image.
- height (optional): Specifies the height of the generated image.
- aspectRatio (optional): Defines the aspect ratio of the image.
- numOutputs (optional): Number of images to generate (1 to 4).
- outputFormat (optional): Format of the output images (e.g., webp, jpg, png).
- guidanceScale (optional): A scale for the diffusion process.
- outputQuality (optional): Quality of the output image (0 to 100).
- Additional parameters like loraScale, promptStrength, and others allow for further customization.
Example Input JSON:
{
"model": "dev",
"prompt": "RGNA high quality, detailed, ultrarealistic photography, very cute skinny thin 30-year-old woman, dark hair, broad chin, skin imperfections, face photo",
"loraScale": -0.8,
"numOutputs": 3,
"aspectRatio": "9:16",
"outputFormat": "webp",
"guidanceScale": 2.38,
"outputQuality": 90,
"promptStrength": 0.8,
"numInferenceSteps": 28,
"additionalLoraScale": 1
}
Output
The action will return an array of URLs pointing to the generated images. For example:
Example Output:
[
"https://assets.cognitiveactions.com/invocations/3baffa55-508a-45ad-9cc9-8a4a9c9707b7/437c0c4f-6036-47e4-bec5-b31668d797e1.webp",
"https://assets.cognitiveactions.com/invocations/3baffa55-508a-45ad-9cc9-8a4a9c9707b7/de36d52c-8c5e-4020-abfd-30e7d46bd81e.webp",
"https://assets.cognitiveactions.com/invocations/3baffa55-508a-45ad-9cc9-8a4a9c9707b7/c238ef91-b7e4-4004-b2f4-26505f7d9cd5.webp"
]
Conceptual Usage Example (Python)
Here’s how you might implement a call to the Generate Image with 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 = "8e6556fb-8191-4295-823e-76138969f37e" # Action ID for Generate Image with Inpainting
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "RGNA high quality, detailed, ultrarealistic photography, very cute skinny thin 30-year-old woman, dark hair, broad chin, skin imperfections, face photo",
"loraScale": -0.8,
"numOutputs": 3,
"aspectRatio": "9:16",
"outputFormat": "webp",
"guidanceScale": 2.38,
"outputQuality": 90,
"promptStrength": 0.8,
"numInferenceSteps": 28,
"additionalLoraScale": 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 code snippet, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload object is constructed based on the required input for the action. The response will include URLs to the generated images.
Conclusion
The Generate Image with Inpainting action from the biguloff/regina-aurore API provides an impressive set of features for developers looking to integrate advanced image generation capabilities into their applications. By leveraging customizable parameters and advanced image prediction models, you can create stunning visuals that meet your specific needs. Explore the possibilities and enhance your applications with these powerful Cognitive Actions!