1.0.8 • Published 15 days ago

decor8ai v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

Decor8 AI Javascript SDK

Table of Contents

Overview

Decor8 AI is a cutting-edge interior design app that revolutionizes your design experience. It offers a rich tapestry of customization options allowing you to visualize and craft interiors that echo your style and imagination.

You can choose from 35+ interior design styles and 20+ room types to create unique interior design styles for your space.

The app specializes in virtual staging, transforming empty spaces into vivid, attractive interiors, enhancing their appeal for better marketability.

Equipped with a powerful Javascript SDK, Decor8 AI facilitates seamless integrations, enabling enhanced design generation capabilities directly within your Javascript environment.

This documentation describes how you can use Decor8 AI Javascript SDK to integrate Decor8 AI's powerful features in your application.

See complete documentation for Decor8 AI api for Virtual Staging and Interior Design. Please reach out to Decor8 AI Team with questions or suggestions.

Installation

You can install the Decor8 AI Javascript SDK using pip:

npm install decor8ai

Configure Decor8 AI API key

Sign in to Decor8 AI

Click on Profile Photo on Top Left

npm.io

Click Generate API Key

npm.io

Usage

export DECOR8AI_API_KEY='<YOUR_API_KEY>'

Generating Interior Design with a Photo of the room

const Decor8AI = require('decor8ai');
const fs = require('fs');
const path = require('path');

// Make sure DECOR8AI_API_KEY is set in your environment variables before running this script
const decor8 = new Decor8AI();

const input_image_path = 'https://prod-files.decor8.ai/test-images/sdk_test_image.png';
const room_type = 'bedroom';
const design_style = 'farmhouse';
const num_images = 1;
const keep_original_dimensions = false; // Optional. true or false. If true, then generated designs have same dimensions as the original image. Although, it takes bit longer to generate the design. If false, generated designs have dimensions are chosen by the API.
const color_scheme = 'COLOR_SCHEME_4'; //Optional. 
const speciality_decor = 'SPECIALITY_DECOR_5'; // Optional. 

// Example using generateDesigns with a file path
console.log ("Generating designs for image at path " + input_image_path);
decor8.generateDesignsForRoom(input_image_path, room_type, design_style, null, null, num_images, keep_original_dimensions, color_scheme, speciality_decor)
    .then(response => {
        if (response.error) {
            console.error("An error occurred:", response.error);
        } else {

            //  The response is a JSON object containing the generated designs and other information.
            //  Sample response for successful design generation
            //  {
            //      "error": "",
            //      "message": "Successfully generated designs.",
            //      "info":
            //      {
            //          "images":
            //          [
            //              {
            //                  "uuid": "81133196-4477-4cdd-834a-89f5482bb9d0",
            //                  "url": "<file-to-download>",
            //                  "width": 768,
            //                  "height": 512,
            //                  "captions":
            //                  [
            //                      "Unveiling the art of rustic elegance in this French Country haven, where warmth and sophistication meet effortlessly."
            //                  ]
            //              }
            //          ]
            //      }
            //  }

            //  Sample response when unsuccessful. "error" will be non-empty value.
            //  {
            //      "error": "InvalidInput",
            //      "message": "Invalid input image. Please check the input image and try again.",
            //  }          
            console.log("Message:", response.message);
            const designs = response.info.images;
            designs.forEach((design, index) => {
                console.log(`Design ${index + 1}:`);
                console.log(`UUID: ${design.uuid}`);
                console.log(`Width: ${design.width}`);
                console.log(`Height: ${design.height}`);

                // If you want to save the image data as a file
                // Check if output-data directory exists, if not, create it
                const outputDir = path.join(__dirname, 'output-data');
                if (!fs.existsSync(outputDir)){
                    fs.mkdirSync(outputDir);
                }
                
                // Save the image data as a file in the output-data directory
                const filename = `design_${design.uuid}.jpg`;
                downloadAndSaveImage(design.url, outputDir, filename).catch(err => {
                console.error(err);
                });
            });

        }
    })
    .catch(error => {
        console.error("An error occurred while generating designs:", error);
    });

Generating Inspirational Interior Design Ideas without using a photo of the room

const Decor8AI = require('decor8ai');
const fs = require('fs');
const path = require('path');

// Make sure DECOR8AI_API_KEY is set in your environment variables before running this script
const decor8 = new Decor8AI();

const room_type = 'bedroom';
const design_style = 'farmhouse';
const num_images = 1;

// Example using generateDesigns with a file path
console.log ("Generating designs for image at path " + input_image_path);

// Note that input_image parameter is null. Decor8 AI server will generate a 
// new interior design for room_type and design_style.
decor8.generateDesigns(null, room_type, design_style, null, num_images)

Priming the walls

If your room contains unfinished walls, unpainted walls or walls which need touch-up, use this API to get walls with basic white colored, smooth textured walls or as it's called 'primed walls'.

You can use the returned image as input to generate_designs API for filling it with furniture.

const Decor8AI = require('decor8ai');
const decor8 = new Decor8AI();

decor8.primeWallsForRoom('https://prod-files.decor8.ai/test-images/sdk_test_image.png')
    .then(response => console.log(response))
    .catch(error => console.error(error));

Upscale the image

AI generated designs may have a smaller resolution for some use-cases. Use this API to get upto 4x the original resolution of the image. Original images of upto maximum 1024px width or height or both are supported.

const Decor8AI = require('decor8ai');
const decor8 = new Decor8AI();

const input_image_path_for_upscaling = './sdk_upscale_this_image.jpg';
const scale_factor = 2;
decor8.upscaleImage(input_image_path_for_upscaling, scale_factor)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Generate captions for the interior image

If you need apt captions for an image depicting a specific interior design style in a room, use this API.

const Decor8AI = require('decor8ai');
const decor8 = new Decor8AI();

room_type = 'livingroom'
design_style = 'frenchcountry'

decor8.generateImageCaptions(room_type, design_style, num_captions = 2)
Sample output

{
    "error": "",
    "message": "Successfully generated image captions.",
    "info":
    {
        "captions":
        [
            "\"Enchanting French Country Charm: Where cozy meets elegance in the heart of the living room.\"",
            "\"Step into a Parisian dream - where charm, elegance, and comfort seamlessly blend in this enchanting French country living room retreat. Get ready to indulge in rustic sophistication and let the cozy embrace of timeless design whisk you away to provincial bliss.\""
        ]
    }
}

Supported Design Styles

Decor8 AI supports following design styles. Learn more about these styles at [Decor8 AI Decoration Styles](https://www.decor8.ai/interior-decoration-styles/)

Design Styles
minimalistscandinavianindustrialboho
traditionalartdecomidcenturymoderncoastal
tropicaleclecticcontemporaryfrenchcountry
rusticshabbychicvintagecountry
modernasian_zenhollywoodregencybauhaus
mediterraneanfarmhousevictoriangothic
moroccansouthwesterntransitionalmaximalist
arabicjapandiretrofuturismartnouveau

Supported Room Types

Decor8 AI supports following room types. Learn more about these room types at [Decor8 AI Room Types](https://www.decor8.ai/rooms)

Room Type
livingroomkitchendiningroombedroom
bathroomkidsroomfamilyroomreadingnook
sunroomwalkinclosetmudroomtoyroom
officefoyerpowderroomlaundryroom
gymbasementgaragebalcony
cafehomebarstudy_roomfront_porch
back_porchback_patio

Supported Color Schemes

Decor8 AI supports following color schemes.

Color Scheme ValueDescription
COLOR_SCHEME_0Default
COLOR_SCHEME_1Moss Green, Tan, White
COLOR_SCHEME_2Gray, Sand, Blue
COLOR_SCHEME_3Hunter Green, Red
COLOR_SCHEME_4White, Pops of Color
COLOR_SCHEME_5Blue, Neon
COLOR_SCHEME_6Light Blue, Emerald
COLOR_SCHEME_7Blue, Grass Green
COLOR_SCHEME_8Blue, Beige
COLOR_SCHEME_9Gray, Brown
COLOR_SCHEME_10Black, Red
COLOR_SCHEME_11Gray-Green, White, Black
COLOR_SCHEME_12Blue, Gray, Taupe
COLOR_SCHEME_13Black, Navy
COLOR_SCHEME_14Emerald, Tan
COLOR_SCHEME_15Forest Green, Light Gray
COLOR_SCHEME_16Yellow, Gray
COLOR_SCHEME_17Pink, Green
COLOR_SCHEME_18Blush Pink, Black
COLOR_SCHEME_19Black, White
COLOR_SCHEME_20Blue, White

Supported Seasonal / Special Décor

Decor8 AI supports following seasonal décor.

Speciality Decor ValueDescription
SPECIALITY_DECOR_0None
SPECIALITY_DECOR_1Halloween Decor with Spooky Ambiance, Eerie Elements, Dark Colors, and Festive Accents
SPECIALITY_DECOR_2Christmas Decor with Christmas Tree, Ornaments, and Lights
SPECIALITY_DECOR_3Thanksgiving Decor, Fall Season Decor
SPECIALITY_DECOR_4Fall Season Decor
SPECIALITY_DECOR_5Spring Season Decor
SPECIALITY_DECOR_6Summer Season Decor
SPECIALITY_DECOR_7Winter Season Decor
1.0.8

15 days ago

1.0.7

22 days ago

1.0.6

24 days ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

4 months ago

1.0.2

5 months ago

1.0.1

7 months ago

1.0.0

7 months ago