Create Stunning Gilded Age Images Using Cognitive Actions

The doctorparadox/gilded-age API offers developers a powerful tool for image generation, specifically tailored to recreate the unique aesthetics of the Gilded Age. With the ability to produce high-quality images through various customizable parameters, these Cognitive Actions allow for innovative applications in art, marketing, and historical recreations. Let's explore how to utilize these actions effectively.
Prerequisites
Before you can start using the Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform to authenticate your requests.
- Familiarity with making HTTP requests and handling JSON data.
Typically, you will authenticate by including the API key in the request headers as follows:
headers = {
"Authorization": f"Bearer {YOUR_API_KEY}",
"Content-Type": "application/json"
}
Cognitive Actions Overview
Create Gilded Age Style Images
This action generates new images styled in the Gilded Age era, offering advanced options for inpainting, resolution adjustments, and fast generation modes. It supports reproducible results through random seeds and diverse image formats.
Input
The input for this action requires the following schema:
- prompt (string, required): A description of the desired image.
- mask (string, optional): URI of an image mask for inpainting mode.
- seed (integer, optional): Ensures consistent outputs across runs.
- image (string, optional): URI of the input image for inpainting.
- model (string, optional): Selects the model for inference; options include
"dev"and"schnell". - width (integer, optional): Specifies the image width (between 256 and 1440).
- height (integer, optional): Specifies the image height (between 256 and 1440).
- imageFormat (string, optional): Specifies the output format (webp, jpg, png).
- outputCount (integer, optional): Number of images generated (between 1 and 4).
- imageQuality (integer, optional): Quality level for output images (0-100).
- mainLoraScale (number, optional): Strength of main LoRA application.
- enableFastMode (boolean, optional): Toggles fast processing mode.
- promptInfluence (number, optional): Extent of prompt influence during processing.
- imageAspectRatio (string, optional): Determines the aspect ratio of the generated image.
- inferenceStepCount (integer, optional): Total number of denoising steps (1-50).
- additionalLoraScale (number, optional): Strength for extra LoRA.
- approximateMegapixels (string, optional): Specifies the approximate megapixels of the image.
- safetyCheckerDisabled (boolean, optional): Option to disable safety checks.
Example Input:
{
"model": "dev",
"prompt": "GILDED Age Scene: A rich tycoon and his wife are walking by the poor and laughing at them in 1890s New York City during the Gilded Age",
"imageFormat": "webp",
"outputCount": 4,
"imageQuality": 80,
"mainLoraScale": 1,
"enableFastMode": false,
"promptInfluence": 0.8,
"imageAspectRatio": "16:9",
"inferenceStepCount": 28,
"additionalLoraScale": 1,
"approximateMegapixels": "1",
"diffusionGuidanceScale": 3
}
Output
The action will return a list of URIs pointing to the generated images. Example Output:
[
"https://assets.cognitiveactions.com/invocations/60a793a8-faad-445d-b733-16545d643c14/64b81a8e-35af-4895-8fd6-305ad5fd068b.webp",
"https://assets.cognitiveactions.com/invocations/60a793a8-faad-445d-b733-16545d643c14/b81ff424-02e4-4a4a-8a2a-7b5e00f1a65f.webp",
"https://assets.cognitiveactions.com/invocations/60a793a8-faad-445d-b733-16545d643c14/3a5e3c2f-287d-47da-a077-a47e6a3e4c2f.webp",
"https://assets.cognitiveactions.com/invocations/60a793a8-faad-445d-b733-16545d643c14/0372f83b-8f0d-4f37-b6ed-e409d0cde0ce.webp"
]
Conceptual Usage Example (Python)
Here's a conceptual Python snippet demonstrating how to invoke the Create Gilded Age Style Images action:
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 = "d033f0bf-7215-4bd9-b8a7-80bd696b5159" # Action ID for Create Gilded Age Style Images
# Construct the input payload based on the action's requirements
payload = {
"model": "dev",
"prompt": "GILDED Age Scene: A rich tycoon and his wife are walking by the poor and laughing at them in 1890s New York City during the Gilded Age",
"imageFormat": "webp",
"outputCount": 4,
"imageQuality": 80,
"mainLoraScale": 1,
"enableFastMode": False,
"promptInfluence": 0.8,
"imageAspectRatio": "16:9",
"inferenceStepCount": 28,
"additionalLoraScale": 1,
"approximateMegapixels": "1",
"diffusionGuidanceScale": 3
}
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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID corresponds to the Create Gilded Age Style Images action. The payload is structured based on the required fields, ensuring that the request is formatted correctly for the API.
Conclusion
The Cognitive Actions provided in the doctorparadox/gilded-age API enable developers to generate stunning images that capture the essence of the Gilded Age. With various customizable parameters, you can tailor the output to suit your specific needs, whether for artistic projects, educational purposes, or marketing materials. Ready to bring history to life? Start integrating these actions into your applications today!