Create Stunning Images with the srrafaelsales/teste-01 Cognitive Actions

In today's digital landscape, the demand for high-quality image generation is on the rise. The srrafaelsales/teste-01 API provides a powerful set of Cognitive Actions designed to help developers create stunning images through advanced techniques such as inpainting and customizable parameters. With these pre-built actions, integrating image generation capabilities into your applications is not only feasible but highly efficient.
Prerequisites
To get started with the Cognitive Actions, you'll need an API key for the Cognitive Actions platform. This key will be used to authenticate your requests. Generally, authentication is handled by including the API key in the headers of your requests, ensuring secure access to the service.
Cognitive Actions Overview
Generate Image with Inpainting
The Generate Image with Inpainting action employs advanced models to create images based on a descriptive prompt. This action supports features such as image inpainting, aspect ratio customization, and fast generation modes, allowing for high-quality outputs tailored to your needs.
Input
The input schema for this action requires the following fields:
- prompt (required): A descriptive prompt for the generated image.
- mask (optional): URI of the image mask for inpainting mode.
- seed (optional): Random seed for reproducible image generation.
- image (optional): URI of an input image for image-to-image or inpainting mode.
- width (optional): Width of the generated image (effective with custom aspect ratio).
- height (optional): Height of the generated image (effective with custom aspect ratio).
- modelType (optional): Selects the inference model (default is "dev").
- imageFormat (optional): Specifies the output image format (default is "webp").
- outputCount (optional): Number of output images to generate (default is 1).
- imageQuality (optional): Quality level for saved output images (default is 80).
- loraIntensity (optional): Intensity scale for the main LoRA (default is 1).
- enableFastMode (optional): Activates faster generation (default is false).
- imageResolution (optional): Approximate resolution of the generated image (default is "1").
- promptIntensity (optional): Adjusts prompt intensity for img2img mode (default is 0.8).
- guidanceStrength (optional): Controls the guidance scale during the diffusion process (default is 3).
- imageAspectRatio (optional): Defines the aspect ratio for the image (default is "1:1").
- weightReferences (optional): Reference for loading LoRA weights.
- inferenceStepsCount (optional): Number of denoising steps (default is 28).
- additionalLoraWeights (optional): Additional LoRA weights.
- safetyCheckerDisabled (optional): Disables the safety checker for generated images.
- additionalLoraIntensity (optional): Scale for additional LoRA (default is 1).
Example Input:
{
"prompt": "teste-01 Ultra-realistic portrait of an elegant man, inspired by the Kingsman universe, in a sophisticated and minimalist home office. He wears a modern slim t-shirt in neutral tones, with a relaxed and confident posture. The image is captured as a medium shot (half body only - from chest above), highlighting his determined expression and the details of his attire. The environment features soft natural lighting, a refined color palette but solid, with no furnitures as a studio photo.",
"modelType": "dev",
"imageFormat": "webp",
"outputCount": 1,
"imageQuality": 80,
"loraIntensity": 1,
"enableFastMode": false,
"imageResolution": "1",
"promptIntensity": 0.8,
"guidanceStrength": 3,
"imageAspectRatio": "4:5",
"inferenceStepsCount": 28,
"additionalLoraIntensity": 1
}
Output
The action typically returns a list of URLs pointing to the generated images.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/1e1068f9-2726-44b6-9ee4-2253dd51d3a3/3cb29e9a-2f38-433e-800d-3b07064d4292.webp"
]
Conceptual Usage Example (Python)
Here’s how you might call 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 = "bda17f0f-ca29-4a0e-9d50-352a414ae0d5" # Action ID for Generate Image with Inpainting
# Construct the input payload based on the action's requirements
payload = {
"prompt": "teste-01 Ultra-realistic portrait of an elegant man, inspired by the Kingsman universe, in a sophisticated and minimalist home office. He wears a modern slim t-shirt in neutral tones, with a relaxed and confident posture. The image is captured as a medium shot (half body only - from chest above), highlighting his determined expression and the details of his attire. The environment features soft natural lighting, a refined color palette but solid, with no furnitures as a studio photo.",
"modelType": "dev",
"imageFormat": "webp",
"outputCount": 1,
"imageQuality": 80,
"loraIntensity": 1,
"enableFastMode": False,
"imageResolution": "1",
"promptIntensity": 0.8,
"guidanceStrength": 3,
"imageAspectRatio": "4:5",
"inferenceStepsCount": 28,
"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 the above code snippet, we replace YOUR_COGNITIVE_ACTIONS_API_KEY with your API key and send a request to the hypothetical Cognitive Actions endpoint. The input payload is structured according to the action's requirements, and the response will contain the URL(s) of the generated images.
Conclusion
The srrafaelsales/teste-01 Cognitive Actions provide a robust solution for developers looking to integrate advanced image generation capabilities into their applications. With features like inpainting, customizable aspect ratios, and various output formats, you can easily create stunning visuals that meet your project requirements. Explore these actions further to unlock their full potential in your upcoming projects!