keras-predict

A nodejs Native addons to run Keras ML model.


Keywords
napi, n-api, native, addon, asynchronous, async, callback, cpp17, keras, ml, nodejs, prediction
License
MIT
Install
npm install keras-predict@0.2.9

Documentation

keras-predict

A Nodejs Native addons to run Keras ML model.

Run Keras ML model via frugally-deep as a native Nodejs Addons.

Usage:

  • first install frugally-deep.
  • compile your keras model :
python3 frugally-deep/keras_export/convert_model.py keras_model.h5 fdeep_model.json
  • path the size of your ML input and converted ML path to predict function.
const predict = require('keras-predict')
const path = require('path');
const mlModelPath = path.resolve(__dirname, "fdeep_model.json");
const testCase = [...];
predict.predict(120, mlModelPath, testCase, (err, predict) => {
       if (err) {
           console.error(err)
       } else {
           console.dir(predict.map(Math.round))
       }
   })
}
  • A working example avialable at example folder.
  • This module tested only on ArchLinux.

Amin Aghabeiki.