Unhandled Rejection (TypeError): t is not a function

Hi there,

I’m currently experimenting with TF.js.

Using the pre-packaged models is a real walk in the park. But when trying to load models (TF.js, TF Lite or from TF-hub) I seem to be getting an error while predicting:

image

The code I’m running is the following:

      .then(() => {
        return tf.loadGraphModel(
          "https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json"
        )
      })
      .then((model) => {
        let img = tf.browser.fromPixels(document.getElementById("image"))
        img = img.cast("float32").reshape([1, 224, 224, 3])
        return model.predict(img)
      })
      .then((predictions) => {
        console.log(predictions)
      })```

I've tried using both `"@tensorflow/tfjs": "^3.5.0",` as well as `"@tensorflow/tfjs": "^3.6.0",`

I'm probably making a rookie mistake here. If anybody would be able to point me in the right direction it would be greatly appreciated!
1 Like

Generally I suggest you to use tags on new thread cause specialized technical team members could be subscribed only to a tag subset (e.g. in this case tfjs and help_request tags).

1 Like