title: Error parsing message with type 'tensorflow.SavedModel'
body: <p>This is the error message i get-</p>
  <pre><code>Traceback:
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/streamlit/script_runner.py&quot;, line 354, in _run_script
      exec(code, module.__dict__)
  File &quot;/app/app.py&quot;, line 131, in &lt;module&gt;
      label, perc = classifier(image, model_file)
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/streamlit/legacy_caching/caching.py&quot;, line 574, in wrapped_func
      return get_or_create_cached_value()
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/streamlit/legacy_caching/caching.py&quot;, line 558, in get_or_create_cached_value
      return_value = func(*args, **kwargs)
  File &quot;/app/app.py&quot;, line 52, in classifier
      model = tf.saved_model.load(&quot;my_model&quot;)
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/tensorflow/python/saved_model/load.py&quot;, line 900, in load
      result = load_internal(export_dir, tags, options)[&quot;root&quot;]
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/tensorflow/python/saved_model/load.py&quot;, line 913, in load_internal
      loader_impl.parse_saved_model_with_debug_info(export_dir))
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/tensorflow/python/saved_model/loader_impl.py&quot;, line 60, in parse_saved_model_with_debug_info
      saved_model = _parse_saved_model(export_dir)
  File &quot;/app/.heroku/python/lib/python3.9/site-packages/tensorflow/python/saved_model/loader_impl.py&quot;, line 108, in parse_saved_model
      raise IOError(f&quot;Cannot parse file {path_to_pb}: {str(e)}.&quot;)
  </code></pre>
  <p>I am trying to run a saved model (pb format) on Heroku. I am calling for loading a saved model using the snippet below-</p>
  <pre><code>    model = tf.keras.models.load_model(&quot;./my_model&quot;)
  
      # Create the array of the right shape to feed into the keras model
      data = np.ndarray(shape=(1, 200, 200, 3), dtype=np.float32)
      image = img
      # image sizing
      size = (200, 200)
      image = ImageOps.fit(image, size, Image.ANTIALIAS)
  
      # turn the image into a numpy array
      image_array = np.asarray(image)
      # Normalize the image
      normalized_image_array = image_array.astype(np.float32) / 255
  
      # Load the image into the array
      data[0] = normalized_image_array
  
      # run the inference
  
      predict_dataset = tf.convert_to_tensor(np.array(normalized_image_array))
  
      # training=False is needed only if there are layers with different
      # behavior during training versus inference (e.g. Dropout).
      predictions = model(predict_dataset, training=False)
      prediction_percentage = predictions.numpy()[0][0]
      prediction = prediction_percentage.round()
  
  
  </code></pre>
  <p>Please note that the model is a tensorflow model saved in pb format and contains multiple files such as variables.data 00000 out of 00001 and saved_model.pb</p>
  <p>Edit- I would like to point out that the model was saved on tensorflow version 2.7.0 using the save method</p>
  <pre><code>@staticmethod
      def model_saver(model_obj):
          try:
              model_obj.save(&quot;./FreshPrice/Output/my_model&quot;)
          except:
              print(&quot;Model not saved successfully!&quot;)
  </code></pre>
  <p>I am trying to run the model on heroku where I am using tensorflow-cpu (2.7.0) to run the loaded model. I used tf-cpu since it has lower size than tf.</p>
  <p>Please advise on the error! any help is appreciated</p>