Skip to main content

Node.js Custom File Path Guide

View this page on the UpscalerJS website

Demonstration of loading a model via a custom file path in Node.js.

Open in CodeSandbox.

Code

If we wish to serve our models from a different point on our file system, or we've brought our own custom model to use in Node.js, we can specify that easily.

note

We'll be using the 2x model from esrgan-slim for this example.

We can specify the model definition with:

const Upscaler = require('upscaler/node')
const upscaler = new Upscaler({
model: {
scale: 2,
path: tf.io.fileSystem('/path/to/model.json'),
}
})

For more information on the modelConfiguration option's attributes, see the section on custom model definitions.