Summary
Hello,
I am trying to build an image recognition web-app using Tensorflow and Streamlit, and when I run the Streamlit app, I get the following error message (It also shows a connection error in the app running on localhost):
Error Message
***[libprotobuf FATAL google/protobuf/message_lite.cc:353] CHECK failed: target + size == res: ***
***libc++abi: terminating due to uncaught exception of type google::protobuf::FatalException: CHECK failed: target + size == res: ***
zsh: abort python -m streamlit run check_img.py
Some more information:
I am trying to load an image and predict. The app runs, loads the image, uses the stored Tensorflow model, and then shows the above error when trying to predict on the uploaded image. My laptop is a Mac M1.
Code Snippet
import streamlit as st
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import load_img,img_to_array
upload = st.file_uploader('Insert image for classification', type=['png','jpg'])
model = load_model(<model_file>)
if upload is not None:
img = load_img(upload, target_size=(x,y))
img = img_to_array(img)
img = np.expand_dims(img,axis = 0)
st.write(model.predict(img, verbose=0)[0][0])
Versions (python==3.8.16)
streamlit==1.23.1
tensorboard==2.12.3
tensorboard-data-server==0.7.0
tensorboard-plugin-wit==1.8.1
tensorflow==2.12.0
tensorflow-estimator==2.12.0
tensorflow-io-gcs-filesystem==0.32.0
tensorflow-macos==2.12.0
tensorflow-metal==1.0.0