Skip to content

Error: predict() must take an object where the keys are the named inputs of the model: #137

@hmhwe

Description

@hmhwe

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'
  },

  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions