Load Tensorflow js model from local file system in javascript

前端 未结 7 1237
一个人的身影
一个人的身影 2020-11-30 10:31

I have converted a keras model to tensorflow json format and saved it locally in my computer. I am trying to load that json model in a javascript code using the below comman

7条回答
  •  天涯浪人
    2020-11-30 11:21

    Check out our documentation for loading models: https://js.tensorflow.org/api/latest/#Models-Loading

    You can use tf.loadModel takes a string which is a URL to your model definition which needs to get served over HTTP. This means you need to start an http-server to serve those files (it will not allow you to make a request to your filesystem because of CORS).

    This package can do that for you: npmjs.com/package/http-server

提交回复
热议问题