Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hmhwe opened this issue Jan 8, 2019 · 0 comments

Comments

@hmhwe
Copy link

hmhwe commented Jan 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant