Generate Stunning Images with pandas9/flux-dev-stoiqo Cognitive Actions

Integrating advanced image generation capabilities into your applications has never been easier with the pandas9/flux-dev-stoiqo Cognitive Actions. This set of actions allows developers to leverage the power of the STOIQO NewReality FLUX model, enabling the generation of high-quality images based on descriptive text prompts. By utilizing these pre-built actions, you can enhance user experiences, automate content creation, and personalize applications with stunning visuals.
Prerequisites
Before you start using the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Familiarity with JSON and Python, as the integration will involve structuring input and handling responses in these formats.
Authentication typically involves passing your API key in the request headers.
Cognitive Actions Overview
Generate Image with STOIQO NewReality FLUX
The Generate Image with STOIQO NewReality FLUX action is designed to create high-quality images from text prompts. It offers customizable settings such as aspect ratio, output format, quality, and more, while also enabling reproducibility through seed values.
Input: The input schema for this action requires the following fields:
- seed (integer, optional): Sets a seed for reproducibility. Random by default.
- prompt (string, required): The descriptive text that serves as the basis for the image generation.
- modelType (string, optional): Specifies the model to use for image generation. Defaults to
STOIQONewrealityFLUXSD_F1DAlpha. - aspectRatio (string, optional): Defines the aspect ratio of the image. Defaults to
1:1. - outputFormat (string, optional): Specifies the format of the output image (webp, jpg, png). Defaults to
webp. - outputQuality (integer, optional): Ranges from 0 (lowest) to 100 (highest). Defaults to 95.
- addLoraFeature (boolean, optional): Determines whether to add the LoRA feature to the model. Defaults to false.
- loraInitialScale (number, optional): Initial scale value for the LoRA feature, ranging from -1 to 1. Defaults to 0.5.
- imageGuidanceLevel (number, optional): Scale for guiding the image generation process, ranging from 0.1 to 10. Defaults to 2.5.
- inferenceStepCount (number, optional): Number of steps for inference during image generation, ranging from 1 to 50. Defaults to 28.
Example Input:
{
"prompt": "boring low quality snapchat photo circa 2015, Selfie photo of cute woman with soft light brown hair in a car, The light from the setting sun gives a soft orange glow across her face and upper body, casting long shadows",
"modelType": "STOIQONewrealityFLUXSD_F1DAlpha",
"aspectRatio": "1:1",
"outputFormat": "webp",
"outputQuality": 95,
"addLoraFeature": false,
"loraInitialScale": 0.5,
"imageGuidanceLevel": 2.5,
"inferenceStepCount": 28
}
Output: The action typically returns a URL pointing to the generated image. An example output might look like this:
[
"https://assets.cognitiveactions.com/invocations/926426f6-46cb-44a7-af47-96f903f6bbeb/d58fea0c-a9a6-4664-b91d-227390c33363.webp"
]
Conceptual Usage Example (Python): Here's a conceptual Python code snippet demonstrating how to call the Generate Image action using a hypothetical Cognitive Actions execution endpoint:
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 = "7fdff843-a693-4518-81eb-58f2f486cc6f" # Action ID for Generate Image with STOIQO NewReality FLUX
# Construct the input payload based on the action's requirements
payload = {
"prompt": "boring low quality snapchat photo circa 2015, Selfie photo of cute woman with soft light brown hair in a car, The light from the setting sun gives a soft orange glow across her face and upper body, casting long shadows",
"modelType": "STOIQONewrealityFLUXSD_F1DAlpha",
"aspectRatio": "1:1",
"outputFormat": "webp",
"outputQuality": 95,
"addLoraFeature": False,
"loraInitialScale": 0.5,
"imageGuidanceLevel": 2.5,
"inferenceStepCount": 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, you will need to replace the placeholder for the API key and the execution endpoint with your actual values. The action ID and input payload are structured according to the specifications provided.
Conclusion
The pandas9/flux-dev-stoiqo Cognitive Actions empower developers to easily integrate high-quality image generation into their applications. By utilizing the Generate Image action, you can create visually captivating content that enhances user engagement and experience. Explore the possibilities today and take your application to new heights with stunning imagery!