Elevate Your App with Interior Design Visualizations Using Cognitive Actions

In today's digital landscape, creating stunning visual content is essential for engaging users and enhancing their experiences. The Cognitive Actions from the julian-at/interiorly-gen1-dev spec offer powerful tools for generating high-quality interior design visualizations. These pre-built actions leverage advanced image generation techniques, allowing developers to easily integrate beautiful and realistic images into their applications.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have the following:
- An API key for the Cognitive Actions platform.
- A basic understanding of JSON and how to structure API requests.
Authentication typically involves passing your API key in the headers of your requests to securely access the services.
Cognitive Actions Overview
Generate Interior Design Visualizations
Description: This action allows you to create high-quality images focused on interior design and architectural visualization, enhancing textures, lighting, and style adaptation using the Interiorly LoRA model.
- Category: Image Generation
Input
The input for this action requires a well-structured JSON object. Below are the essential fields based on the input schema:
- prompt (required): Describes the desired visualization. Example: "Luxury penthouse living space with large glass windows, marble floors, and high-end furniture."
- width (optional): The width of the generated image (must be a multiple of 16).
- height (optional): The height of the generated image (must be a multiple of 16).
- goFast (optional): Boolean to enable faster predictions with a speed-optimized model.
- modelType (optional): Specifies which model to use for inference (default is "dev").
- megapixels (optional): Approximate number of megapixels for the generated image.
- aspectRatio (optional): Determines the aspect ratio of the created image.
- outputFormat (optional): The format of the output images (e.g., webp, jpg, png).
- guidanceScale (optional): Setting for the guidance scale during the diffusion process.
- outputQuality (optional): Quality setting for saved output images.
- promptStrength (optional): Strength when using img2img.
- numberOfOutputs (optional): How many outputs to generate (1-4).
- inferenceStepsCount (optional): Total number of denoising steps.
Example Input:
{
"width": 1024,
"goFast": false,
"height": 1024,
"prompt": "Luxury penthouse living space with large glass windows, marble floors, and high-end furniture.",
"modelType": "dev",
"megapixels": "1",
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 5,
"outputQuality": 80,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"loraIntensityScale": 1,
"inferenceStepsCount": 35,
"additionalLoraIntensityScale": 1
}
Output
The action typically returns the URL(s) of the generated image(s).
Example Output:
[
"https://assets.cognitiveactions.com/invocations/55d17dc6-ce0c-4297-8d1a-ea30cb05b2ea/8248bfde-db60-4083-9481-e138673ec3ea.webp"
]
Conceptual Usage Example (Python)
Here's how you might call the Cognitive Actions execution endpoint to generate interior design visualizations:
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 = "92fd07c4-3be0-4568-bfc2-72e3a3316d99" # Action ID for Generate Interior Design Visualizations
# Construct the input payload based on the action's requirements
payload = {
"width": 1024,
"goFast": False,
"height": 1024,
"prompt": "Luxury penthouse living space with large glass windows, marble floors, and high-end furniture.",
"modelType": "dev",
"megapixels": "1",
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 5,
"outputQuality": 80,
"promptStrength": 0.8,
"numberOfOutputs": 1,
"loraIntensityScale": 1,
"inferenceStepsCount": 35,
"additionalLoraIntensityScale": 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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the action you are invoking. The payload is structured according to the input schema, specifying the desired properties for the image generation.
Conclusion
The Cognitive Actions in the julian-at/interiorly-gen1-dev spec empower developers to easily generate stunning interior design visualizations. By leveraging these actions, you can enhance your applications with high-quality images that captivate users. Explore various configurations and experiment with different prompts to unlock the full potential of your visual content. Happy coding!