Unlocking Ancient Artistry: Generate Fayum Portraits with Cognitive Actions

The vestigiaproject/fayumportraits offers an innovative way to create stunning images reminiscent of ancient Fayum wood paintings. Leveraging the power of the Flux Dev LoRA model, these Cognitive Actions allow developers to generate unique artworks with customizable parameters. Whether you're looking to produce visually striking art for applications, websites, or personal projects, these pre-built actions simplify the process, enabling you to focus on creativity rather than technical hurdles.
Prerequisites
To get started with the Cognitive Actions for the Fayum portraits, you need to have an API key for the Cognitive Actions platform. This key will typically be passed in the headers of your API requests for authentication. Ensure you have your API key ready to begin integrating these actions into your applications.
Cognitive Actions Overview
Generate Fayum Portrait Image
The Generate Fayum Portrait Image action allows you to create images in the distinctive style of ancient Fayum paintings. This action offers various parameters to control the output, including image dimensions, quality, and model selection, ensuring that you can produce detailed or faster outputs according to your needs.
Input:
The input for this action follows the CompositeRequest schema. Here's a breakdown of the required and optional fields:
- Required:
prompt: A string describing the desired image (e.g., "A Fayum portrait of a man in the style of fayumprtrt, encaustic on wood panel").
- Optional:
mask: URI of an image mask for inpainting mode.seed: An integer for reproducible generation.image: URI of an input image for image-to-image or inpainting mode.width: Desired width of the generated image (256-1440 pixels).height: Desired height of the generated image (256-1440 pixels).aspectRatio: Specifies the aspect ratio (e.g., "4:5").imageFormat: Output format (e.g., "webp").outputCount: Number of images to generate (1-4).imageQuality: Quality of the output images (0-100).guidanceScale: Adjusts the guidance scale for the diffusion process (0-10).denoisingSteps: Number of denoising steps (1-50).enableFastMode: Enables faster predictions with optimized models.inferenceModel: Selects the model for inference (e.g., "dev").promptStrength: Strength of the prompt when using img2img.imageMegapixels: Approximates the number of megapixels (e.g., "1").mainLoraInfluence: Controls the strength of the main LoRA application.additionalLoraInfluence: Determines the influence of additional LoRA.
Example Input:
{
"prompt": "A Fayum portrait of a man in the style of fayumprtrt, encaustic on wood panel",
"aspectRatio": "4:5",
"imageFormat": "webp",
"outputCount": 1,
"imageQuality": 80,
"guidanceScale": 1.8,
"denoisingSteps": 20,
"enableFastMode": true,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageMegapixels": "1",
"mainLoraInfluence": 1,
"additionalLoraInfluence": 1
}
Output:
The action typically returns a link to the generated image(s). For example:
[
"https://assets.cognitiveactions.com/invocations/014cf3de-756f-45fb-9f43-b2dfde48b6cb/c508c1f6-3405-4ec8-8865-ab0b82a0b2dc.webp"
]
Conceptual Usage Example (Python):
Here's a conceptual Python code snippet demonstrating how to call the Generate Fayum Portrait Image 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 = "e0c9e350-7df4-450e-b006-24c9e354b172" # Action ID for Generate Fayum Portrait Image
# Construct the input payload based on the action's requirements
payload = {
"prompt": "A Fayum portrait of a man in the style of fayumprtrt, encaustic on wood panel",
"aspectRatio": "4:5",
"imageFormat": "webp",
"outputCount": 1,
"imageQuality": 80,
"guidanceScale": 1.8,
"denoisingSteps": 20,
"enableFastMode": True,
"inferenceModel": "dev",
"promptStrength": 0.8,
"imageMegapixels": "1",
"mainLoraInfluence": 1,
"additionalLoraInfluence": 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 this code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the Generate Fayum Portrait Image action, and the payload is structured according to the required input schema. The endpoint URL and request structure are illustrative.
Conclusion
The Cognitive Actions for generating Fayum portraits not only simplify the creation of stunning artwork but also empower developers to integrate artistic expression into their applications effortlessly. By utilizing the customization options available, you can tailor your outputs to meet specific needs, making these actions a versatile asset in your development toolkit. Explore the possibilities and start crafting your unique Fayum-inspired images today!