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

In the world of interior design, the ability to visualize changes in space can dramatically enhance the creative process. The jschoormans/interior-v2 API offers a powerful Cognitive Action specifically designed for image transformations. The "Remodel Interior Image" action allows developers to create stunning visualizations of interior spaces by remodeling images based on user-defined prompts. This action not only simplifies the image processing workflow but also enables high-quality outputs through customizable parameters.
Prerequisites
Before integrating the jschoormans/interior-v2 Cognitive Actions into your application, ensure you have the following:
- An API key for the Cognitive Actions platform. This key will be used for authentication when making requests.
- Basic familiarity with making API calls and handling JSON responses.
Authentication typically involves passing your API key in the request headers, ensuring secure access to the available actions.
Cognitive Actions Overview
Remodel Interior Image
The Remodel Interior Image action transforms existing interior images by remodeling the space according to specified prompts. It maintains high-quality outputs and offers adjustable parameters to enhance the remodeling process.
- Category: Image Processing
Input
The input for this action follows the schema defined in the CompositeRequest structure. The required field is image, while several other fields can be adjusted for optimal results.
- Required Fields:
image: A URI pointing to the input image.
- Optional Fields:
prompt: A descriptive string to guide the image generation.strength: Controls the strength of inpainting (default: 0.999999).guidanceScale: Influences adherence to the prompt (default: 7).maxResolution: Sets the maximum resolution for the output image (default: 1536).- Other optional parameters include control images, masking prompts, and guidance settings.
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 output of the action consists of one or more URIs pointing to the remodeled images. These images are generated based on the input parameters and can vary in appearance depending on the specifications provided.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/6abcd367-e737-4587-9bf0-1f636938326f/3d5f3f17-14f0-4c6c-97ea-1680a50d3a43.png",
"https://assets.cognitiveactions.com/invocations/6abcd367-e737-4587-9bf0-1f636938326f/f4d6217f-efe3-4221-b674-8c76d96ed723.png",
"https://assets.cognitiveactions.com/invocations/6abcd367-e737-4587-9bf0-1f636938326f/85c01032-acc2-49a5-b775-4981f4284194.png",
"https://assets.cognitiveactions.com/invocations/6abcd367-e737-4587-9bf0-1f636938326f/ca22ec87-8824-4f58-9561-315132dd456f.png",
"https://assets.cognitiveactions.com/invocations/6abcd367-e737-4587-9bf0-1f636938326f/1fda58e8-2c64-4049-8c75-c65b46238f31.png"
]
Conceptual Usage Example (Python)
Here’s a conceptual example of how you might call the Remodel Interior Image action using a Python script. This example demonstrates how to structure the input JSON payload and make a request to the Cognitive Actions endpoint.
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 = "f0ca062e-ef89-430a-97ee-f88419d35a6c" # Action ID for Remodel Interior Image
# 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
YOUR_COGNITIVE_ACTIONS_API_KEYwith your actual API key. - The
action_idis set to the ID of the Remodel Interior Image action. - The input payload is structured according to the requirements of the action.
- The code sends a POST request to the hypothetical endpoint and prints the resulting images or an error message if the request fails.
Conclusion
The jschoormans/interior-v2 Cognitive Action for remodeling interior images offers developers an innovative way to visualize and alter spaces. By utilizing this action, you can easily integrate powerful image processing capabilities into your applications, enhancing user experience and creativity. Explore the various parameters to customize your image transformations and take your interior design projects to the next level!