Transform Your Spaces with the jschoormans/interior-v2 Cognitive Actions

22 Apr 2025
Transform Your Spaces with the jschoormans/interior-v2 Cognitive Actions

In the realm of interior design, the jschoormans/interior-v2 API offers developers a powerful toolset through its Cognitive Actions, particularly for image generation. These pre-built actions allow for the transformation of basic interior images into high-quality, customized visualizations based on user-defined prompts. By leveraging machine learning, developers can create stunning and stylized interior design images that enhance user engagement and experience.

Prerequisites

Before diving into the integration of the Cognitive Actions, ensure you have the following:

  • An API key for the jschoormans/interior-v2 Cognitive Actions platform.
  • Basic familiarity with making API calls and handling JSON data.
  • A suitable environment for testing API requests, such as Python with the requests library.

Authentication Concept: Typically, you will need to include your API key in the headers of your requests. This can be done by passing an Authorization header with the format Bearer YOUR_API_KEY.

Cognitive Actions Overview

Generate Interior Design

Description:
This action transforms and generates high-quality interior images based on given prompts, allowing for detailed customization in elements such as furniture, room structure, and stylistic details. It includes options for modifying depth maps and control guidance for precise image generation.

Category: image-generation

Input:

  • Required Fields:
    • image (string): The URI of the input image to be processed.
  • Optional Fields:
    • prompt (string): Text prompt for guiding the image generation. Defaults to a high-quality photographic style.
    • strength (number): Controls the strength of the inpainting effect. Value between 0 and 1.
    • controlImage (string): URI of the control image for additional guidance.
    • emptyRoomMode (boolean): If true, modifies the depth map as if the room is empty.
    • guidanceScale (number): Scales the strength of guidance in image generation.
    • Additional fields for masking and controlling various elements...

Example Input:

{
  "image": "https://replicate.delivery/pbxt/LscMB7dbg6KGk8OI5HbaPFLUukh15hFww9X9S5W5NF4u7OUm/149_1440.jpg",
  "prompt": "Living room, scandinavian interior, photograph, clean, beautiful, high quality, 8k",
  "strength": 0.999999,
  "guidanceScale": 7,
  "maxResolution": 1051,
  "negativePrompt": "(worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch), open mouth",
  "maskPromptWindow": "window, doorway",
  "maskPromptCeiling": "ceiling",
  "numInferenceSteps": 30,
  "controlGuidanceEnd": 0.8,
  "maskPromptFurniture": "furniture, couch, table, chair, desk, bed, sofa, cupboard, shelf, cabinet, bookcase, dresser, nightstand, armchair, decoration, plant, flower, pillow, lamp, TV",
  "controlGuidanceStart": 0,
  "keepFurnitureStructure": false,
  "controlnetConditioningScale": 0.03
}

Output: The action typically returns an array of URIs pointing to the generated images, like:

[
  "https://assets.cognitiveactions.com/invocations/3d1672b0-6483-43bc-a8a0-af03c177035f/a17a6d95-d9a2-4d0d-bb18-58b8d825e273.png",
  "https://assets.cognitiveactions.com/invocations/3d1672b0-6483-43bc-a8a0-af03c177035f/1a34c64e-1f66-45ad-b5e0-a0730cecc0e2.png",
  ...
]

Conceptual Usage Example (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 = "112dccb4-b273-41f3-90b3-49267a9524d1" # Action ID for Generate Interior Design

# Construct the input payload based on the action's requirements
payload = {
    "image": "https://replicate.delivery/pbxt/LscMB7dbg6KGk8OI5HbaPFLUukh15hFww9X9S5W5NF4u7OUm/149_1440.jpg",
    "prompt": "Living room, scandinavian interior, photograph, clean, beautiful, high quality, 8k",
    "strength": 0.999999,
    "guidanceScale": 7,
    "maxResolution": 1051,
    "negativePrompt": "(worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch), open mouth",
    "maskPromptWindow": "window, doorway",
    "maskPromptCeiling": "ceiling",
    "numInferenceSteps": 30,
    "controlGuidanceEnd": 0.8,
    "maskPromptFurniture": "furniture, couch, table, chair, desk, bed, sofa, cupboard, shelf, cabinet, bookcase, dresser, nightstand, armchair, decoration, plant, flower, pillow, lamp, TV",
    "controlGuidanceStart": 0,
    "keepFurnitureStructure": False,
    "controlnetConditioningScale": 0.03
}

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 the action ID and input payload with the corresponding details for the Generate Interior Design action. The endpoint URL and request structure are illustrative, and you can adjust them based on your actual implementation.

Conclusion

The jschoormans/interior-v2 Cognitive Actions empower developers to create stunning, customized interior designs with ease. By utilizing the Generate Interior Design action, you can enhance user experiences and provide visually appealing content tailored to specific requirements. Explore the possibilities and start integrating these actions into your applications today!