Generate Stunning Historical Images with the Neurealhistory3 Cognitive Actions

In the realm of AI-driven creativity, the Neurealhistory3 Cognitive Actions offer a powerful toolset for developers looking to generate captivating historical images. By leveraging advanced techniques and extensive training on over 300 colorized photos from the 1850s-1940s, these actions enable you to create visually stunning representations that can serve various applications—from art to education. In this article, we will explore the capabilities of the "Generate Historical Image with RealVisXL3" action, detailing how to integrate it into your own applications.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure that you have the following:
- API Key: You will need an API key to access the Cognitive Actions platform. This key should be included in the headers of your requests for authentication.
- Basic Knowledge of JSON and API Calls: Familiarity with making HTTP requests and handling JSON data will be beneficial.
Authentication typically involves passing your API key as a Bearer token in the request headers.
Cognitive Actions Overview
Generate Historical Image with RealVisXL3
Description: This action generates historical images using the RealVisXL3 model, applying advanced image generation techniques. It is particularly useful for creating visually rich images based on user-defined prompts or existing images.
Category: Image Generation
Input
To invoke this action, you need to construct a JSON payload that adheres to the following schema:
- mask (string, optional): Input mask for inpaint mode. Black areas will be preserved, while white areas will be inpainted.
- seed (integer, optional): Random seed for generating images. Leave blank for a random seed.
- image (string, optional): Input image URI for img2img or inpaint mode operations.
- width (integer, default: 768): Width of the output image in pixels.
- height (integer, default: 768): Height of the output image in pixels.
- prompt (string, required): Text prompt guiding the image generation process.
- refine (string, default: "no_refiner"): Select the refining method to apply during processing.
- loraScale (number, default: 0.6): LoRA additive scale factor, applicable to trained models.
- scheduler (string, default: "K_EULER"): Select the scheduling algorithm for processing.
- refineSteps (integer, optional): Number of refinement steps for 'base_image_refiner'.
- customWeights (string, optional): Specifies custom LoRA weights to use.
- guidanceScale (number, default: 7.5): Scale for classifier-free guidance.
- applyWatermark (boolean, default: false): Determines if a watermark is applied to the image.
- negativePrompt (string, optional): Attributes to avoid during image generation.
- promptStrength (number, default: 0.8): Strength of the prompt when using img2img/inpaint.
- numberOfOutputs (integer, default: 1): Number of images to generate (maximum: 4).
- highNoiseFraction (number, default: 0.8): Fraction of noise for 'expert_ensemble_refiner'.
- disableSafetyChecker (boolean, default: false): Option to disable the safety checker.
- numberOfInferenceSteps (integer, default: 25): Number of denoising steps in the generation process.
Example Input:
{
"width": 1024,
"height": 576,
"prompt": "top quality HST photograph of full height young Arthur Rimbaud in the 1870s, realistic detailed face, realistic skin texture, dslr, realistic proportions, masterpiece professional photo, detailed irised eyes, lifelike textures, realistic detailed face, detailed 1870s cityscape background,",
"refine": "no_refiner",
"loraScale": 0.81,
"scheduler": "DPMSolverMultistep",
"guidanceScale": 8.41,
"applyWatermark": false,
"negativePrompt": "pale, unrealistic, cgi, overexposed, undersaturated, oversaturated, warped, deformed, duplicated, unrealistic anatomy, cartoon, low quality, smoothed skin, computer generated, synthetic, blur",
"promptStrength": 0.8,
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 41
}
Output
The action typically returns a list of generated image URLs based on the input parameters.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/fc308a9d-6582-48bd-8ad7-2f9e66510f77/bec55fcc-0678-4153-84ac-bf9fdb4e4aaa.png"
]
Conceptual Usage Example (Python)
Here's how you might structure a Python script to call this 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 = "f662000d-ce2c-45c0-8e8c-7668a4905ce6" # Action ID for Generate Historical Image with RealVisXL3
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"height": 576,
"prompt": "top quality HST photograph of full height young Arthur Rimbaud in the 1870s, realistic detailed face, realistic skin texture, dslr, realistic proportions, masterpiece professional photo, detailed irised eyes, lifelike textures, realistic detailed face, detailed 1870s cityscape background,",
"refine": "no_refiner",
"loraScale": 0.81,
"scheduler": "DPMSolverMultistep",
"guidanceScale": 8.41,
"applyWatermark": False,
"negativePrompt": "pale, unrealistic, cgi, overexposed, undersaturated, oversaturated, warped, deformed, duplicated, unrealistic anatomy, cartoon, low quality, smoothed skin, computer generated, synthetic, blur",
"promptStrength": 0.8,
"numberOfOutputs": 1,
"highNoiseFraction": 0.8,
"numberOfInferenceSteps": 41
}
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 YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is specified for the "Generate Historical Image with RealVisXL3" action, and the input payload is structured according to the required schema.
Conclusion
The Neurealhistory3 Cognitive Actions provide an exciting opportunity for developers to create historical images with minimal effort. By utilizing the "Generate Historical Image with RealVisXL3" action, you can produce high-quality, visually engaging images tailored to your specific needs. Explore the possibilities these actions offer and consider how they can enhance your applications—whether for storytelling, education, or art. Happy coding!