1.0.11 • Published 5 months ago

decor8ai v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Decor8 AI JavaScript SDK

Table of Contents

Installation

npm install decor8ai

Configuration

Set your API key as an environment variable:

export DECOR8AI_API_KEY='your-api-key-here'

Usage Examples

Room Design Generation

Using Room Type and Style

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

decor8.generateDesignsForRoom(
    'https://example.com/room.jpg',
    'bedroom',
    'frenchcountry',
    null,
    null,
    1,
    'COLOR_SCHEME_0',
    'SPECIALITY_DECOR_0'
)
.then(response => console.log(response))
.catch(error => console.error(error));

Using Custom Prompt with Advanced Parameters

decor8.generateDesignsForRoom(
    'https://example.com/room.jpg',
    null,  // room_type not needed with custom prompt
    null,  // design_style not needed with custom prompt
    null,
    null,
    2,
    null,
    null,
    null,
    'Modern minimalist room with sleek wardrobe, contemporary Table Lamps, and floating Dresser',
    'high end, professional photo',
    'clean lines, ambient lighting',
    'cluttered, traditional, ornate',
    42,
    15.0,
    50
)
.then(response => console.log(response));

Using Simple Custom Prompt

decor8.generateDesignsForRoom(
    'https://example.com/room.jpg',
    null,  // room_type not needed
    null,  // design_style not needed
    null,
    null,
    1,
    null,
    null,
    null,
    'Room with wardrobe, Table Lamps, Dresser',
    null,
    null,
    null,
    null,
    15.0
)
.then(response => console.log(response));

Inspirational Designs

Using Room Type and Style

decor8.generateInspirationalDesigns(
    'bedroom',
    'modern',
    2
)
.then(response => console.log(response));

Using Custom Prompt

decor8.generateInspirationalDesigns(
    null,  // room_type not needed with custom prompt
    null,  // design_style not needed with custom prompt
    2,
    'Luxurious room with ocean view and modern furniture',
    'high end, professional photo',
    'natural lighting',
    'cluttered, dark',
    42,
    15.0,
    50
)
.then(response => console.log(response));

Wall Priming

decor8.primeWallsForRoom('https://example.com/room.jpg')
    .then(response => console.log(response));

Image Captions

decor8.generateImageCaptions('livingroom', 'modern', 2)
    .then(response => console.log(response));

Image Upscaling

decor8.upscaleImage('https://example.com/room.jpg', 2)
    .then(response => console.log(response));

Response Handling

Example response structure:

{
    "error": "",
    "message": "Successfully generated designs.",
    "info": {
        "images": [
            {
                "uuid": "81133196-4477-4cdd-834a-89f5482bb9d0",
                "url": "https://example.com/image.jpg",
                "width": 768,
                "height": 512,
                "captions": [
                    "Modern minimalist bedroom with sleek furniture and ambient lighting"
                ]
            }
        ]
    }
}

Saving Generated Images

const fs = require('fs');
const https = require('https');
const path = require('path');

function downloadAndSaveImage(url, outputDir, filename) {
    return new Promise((resolve, reject) => {
        https.get(url, (response) => {
            if (response.statusCode === 200) {
                const fileStream = fs.createWriteStream(path.join(outputDir, filename));
                response.pipe(fileStream);
                fileStream.on('finish', () => {
                    fileStream.close();
                    resolve();
                });
            } else {
                reject(new Error(`Failed to download image: ${response.statusCode}`));
            }
        });
    });
}

// Usage in response handling
response.info.images.forEach((design, index) => {
    const filename = `design_${design.uuid}.jpg`;
    downloadAndSaveImage(design.url, './output', filename);
});

Parameters Reference

Common Parameters

ParameterTypeDescription
input_image_urlstringURL of the input image
room_typestringType of room (e.g., 'bedroom', 'livingroom')
design_stylestringDesign style (e.g., 'modern', 'frenchcountry')
num_imagesnumberNumber of images to generate (default: 1)
promptstringCustom prompt describing desired outcome
prompt_prefixstringText to prepend to the prompt
prompt_suffixstringText to append to the prompt
negative_promptstringThings to avoid in generation
seednumberRandom seed for reproducible results
guidance_scalenumberControls how closely to follow the prompt (default: 7.5)
num_inference_stepsnumberNumber of denoising steps (default: 30)

Additional Features

FeatureDescription
color_schemePredefined color schemes (e.g., 'COLOR_SCHEME_0')
speciality_decorSpecial decorative themes (e.g., 'SPECIALITY_DECOR_0')
scale_factorImage scaling factor for output

For complete API documentation, visit Decor8 AI API Documentation

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

11 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago