Enhance Interior Design with Cognitive Actions from orbin-ahmed/interior

In today's fast-paced digital landscape, leveraging AI-powered tools can significantly enhance design workflows. The orbin-ahmed/interior API provides powerful Cognitive Actions that enable developers to generate sophisticated interior design predictions based on user-defined images and prompts. By utilizing these pre-built actions, you can save time and effort while achieving creative results tailored to specific requirements.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have the following:
- An API key for accessing the Cognitive Actions platform.
- Basic familiarity with making API calls.
To authenticate your requests, you will typically pass the API key in the headers of your requests, allowing secure access to the Cognitive Actions features.
Cognitive Actions Overview
Execute Interior Design Prediction
The Execute Interior Design Prediction action generates a design prediction for an interior image based on a guiding text prompt. This action allows you to enhance or modify the design while excluding undesired elements using a negative prompt. It also offers adjustable classifier guidance and inpainting strength to achieve your desired outcomes.
Input
The input schema for this action consists of several properties:
- image (required): URI of the input image to be processed.
- prompt (required): Text prompt guiding the design process.
- seed (optional): Random seed for consistency across requests.
- guidanceScale (optional, default: 15): Intensity of classifier-free guidance (1 to 50).
- negativePrompt (optional): Text specifying undesirable elements to exclude from the design.
- promptStrength (optional, default: 0.8): Amount of information removed for inpainting (0 to 1).
- numberOfInferenceSteps (optional, default: 50): Number of denoising steps applied (1 to 500).
Here’s an example input JSON payload:
{
"image": "https://replicate.delivery/pbxt/M8ME52E3pCv3yIq5RjRM22oLBq7xznKXo1XR0fE7QptyAoE1/living.jpg",
"prompt": "A living room",
"guidanceScale": 15,
"negativePrompt": "lowres, watermark, banner, logo, watermark, contactinfo, text, deformed, blurry, blur, out of focus, out of frame, surreal, extra, ugly, upholstered walls, fabric walls, plush walls, mirror, mirrored, functional, realistic",
"promptStrength": 0.8,
"numberOfInferenceSteps": 50
}
Output
Upon successful execution, this action returns a URI link to the generated interior design image. For instance:
https://assets.cognitiveactions.com/invocations/39dc8ca0-2f92-44ba-84ee-37b426799789/2913cdff-54a4-4520-b604-625da59668f1.png
Conceptual Usage Example (Python)
Here’s a conceptual example of how to call the Execute Interior Design Prediction action using Python:
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 = "325dea8a-6a5c-4d38-bd80-0c1caf71bf5e" # Action ID for Execute Interior Design Prediction
# Construct the input payload based on the action's requirements
payload = {
"image": "https://replicate.delivery/pbxt/M8ME52E3pCv3yIq5RjRM22oLBq7xznKXo1XR0fE7QptyAoE1/living.jpg",
"prompt": "A living room",
"guidanceScale": 15,
"negativePrompt": "lowres, watermark, banner, logo, watermark, contactinfo, text, deformed, blurry, blur, out of focus, out of frame, surreal, extra, ugly, upholstered walls, fabric walls, plush walls, mirror, mirrored, functional, realistic",
"promptStrength": 0.8,
"numberOfInferenceSteps": 50
}
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 example illustrates how to structure the input JSON payload and handle the API response.
Conclusion
The Cognitive Actions from the orbin-ahmed/interior API offer developers a robust solution for enhancing interior design processes through image processing. By integrating these actions, you can leverage AI to create customized designs efficiently. Explore the potential applications, from real estate staging to interior design mockups, and begin transforming your design workflows today!