Create Stunning Custom Images with frankcruzfe/frankleon1 Cognitive Actions

In the world of digital content creation, the ability to generate custom images can significantly enhance user experience and engagement. The frankcruzfe/frankleon1 API offers a powerful Cognitive Action that allows developers to create customized images through image-to-image transformations or inpainting. With adjustable resolution, quality, and the option to optimize for speed, this action is designed to streamline the creative process for developers.
Prerequisites
To effectively use the Cognitive Actions provided by the frankcruzfe/frankleon1 API, you will need:
- An API key for authentication.
- Basic knowledge of how to make HTTP requests and handle JSON data.
When making requests, the API key should be included in the headers as follows:
Authorization: Bearer YOUR_COGNITIVE_ACTIONS_API_KEY
Content-Type: application/json
Cognitive Actions Overview
Generate Custom Images
Description:
This action allows you to create customized images using image-to-image transformation or inpainting. You can adjust parameters such as resolution, quality, and LoRA intensity, and even choose from various output formats like webp, jpg, or png.
Category: image-generation
Input:
The input for this action requires a JSON payload with the following fields. Below is an example input payload:
{
"model": "dev",
"prompt": "frankleon1 a man in a paradisiacal place, on vacation",
"loraScale": 1,
"guidanceScale": 3.5,
"extraLoraScale": 1,
"promptStrength": 0.84,
"numberOfOutputs": 4,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 90,
"numberOfInferenceSteps": 28
}
- Required Fields:
prompt: A textual prompt that describes the desired image.
- Optional Fields:
model: Choose between "dev" or "schnell".loraScale: Intensity of the main LoRA.guidanceScale: Adjusts the image generation guidance.numberOfOutputs: Number of images to generate.imageAspectRatio: Defines the aspect ratio of the image.imageOutputFormat: Selects the output format (webp, jpg, png).imageOutputQuality: Quality level of the output image.numberOfInferenceSteps: Number of steps for image generation.
Output:
Upon successful execution, the action returns an array of URLs pointing to the generated images. Here's an example output:
[
"https://assets.cognitiveactions.com/invocations/1d7e91cd-4354-4901-9ccb-ca2a93718337/417e022c-b8fe-4555-8d6c-a0c3b94403a2.webp",
"https://assets.cognitiveactions.com/invocations/1d7e91cd-4354-4901-9ccb-ca2a93718337/fa739cf9-e98e-4281-a07f-c7fe2a7d0106.webp",
"https://assets.cognitiveactions.com/invocations/1d7e91cd-4354-4901-9ccb-ca2a93718337/1cabb7cc-0a92-4bcf-ab21-7f18290a963c.webp",
"https://assets.cognitiveactions.com/invocations/1d7e91cd-4354-4901-9ccb-ca2a93718337/3bc17190-e349-461c-b882-86bbf77a882a.webp"
]
Conceptual Usage Example (Python):
Here’s how you can call the Generate Custom Images 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 = "0431c9d1-62ff-4488-885c-2b77a2a109e5" # Action ID for Generate Custom Images
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "frankleon1 a man in a paradisiacal place, on vacation",
"loraScale": 1,
"guidanceScale": 3.5,
"extraLoraScale": 1,
"promptStrength": 0.84,
"numberOfOutputs": 4,
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"imageOutputQuality": 90,
"numberOfInferenceSteps": 28
}
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, the action_id corresponds to the Generate Custom Images action. The payload contains the necessary parameters for generating images, and the response will provide URLs to the generated images.
Conclusion
Using the frankcruzfe/frankleon1 Cognitive Actions, developers can easily create stunning custom images tailored to their requirements. By leveraging pre-built actions, you can save time and resources while enhancing your applications with visually appealing content. Consider integrating these capabilities into your next project to unlock new creative possibilities!