Open hmhwe opened 5 years ago
I have been trying to run a keras model in browser using keras.js. But whenever i try to predict I got the following error
Error: predict() must take an object where the keys are the named inputs of the model: Here is js code handlePredict() { const model = new KerasJS.Model({ filepaths: { model: 'model.json', weights: 'model_weights.buf', metadata: 'model_metadata.json' },
Error: predict() must take an object where the keys are the named inputs of the model: Here is js code
handlePredict() { const model = new KerasJS.Model({ filepaths: { model: 'model.json', weights: 'model_weights.buf', metadata: 'model_metadata.json' },
gpu : true, filesystem : true
})
model.ready().then(() =>{ const inputData = { 'input_1': new Float32Array(samples) } alert('Converted text = ' + inputData['input_1']) return model.predict(inputData['input_1']) }) .then(output => { alert('Predicted value : ' + output['fc1000']); }) .catch(err => { alert(err); }) }
I am using keras-js 0.3.0 and keras 2.2.4 . Any help would be appreciated.
I have been trying to run a keras model in browser using keras.js. But whenever i try to predict I got the following error
})