Facing problem while deploying DL model in Streamlit

Hey everyone👋, I’ve made a DL model and ran it into local development environment… But when I deployed the model in the streamlit cloud it suddenly gave me this error. My application is working fine in my local environment and there is no issue in the code logic. Can anyone is able to help me out? Any kind of help is highly appreciated!
Thanks in advance🙌

My github link of my project👉 SoumyadeepOSD/Sentiment-analysis (github.com)

I suspect that the ML model was generated locally using a different version of Keras/Tensorflow than the version that is installed in Streamlit Cloud.

Make sure it is the same version of keras.

2 Likes

Hey @Franky1 Thanks for replying on my issue, but there is no difference in between the version of keras in local env & in requirements.txt file

How to handle that error?
Is there any another way to install the dependencies in cloud?

How to do that. Can you explain me a bit more?

Looks like you aready did. But that was after deploying, so we don’t know which version is used in the deployed application.

1 Like

I reinstalled all the modules and redeployed in the cloud…but it’s continuously giving me same error…
Can anyone set it up in their local environment?

Just add some debug code in your app, for example:

import tensorflow as tf
import streamlit as st

st.write(f'tensorflow: {tf.__version__}')
st.write(f'streamlit: {st.__version__}')

I created a new Python 3.11 virtual environment, installed your requirements, ran your app in that environment and I got the same error. So there is something different in your environment: different libraries, code, data, I don’t know. The operating system is also different but I wouldn’t expect that to be an iisue.

This is what I did, after downloading your repo at commit 15b80b39f2:

python -m venv .venv
source .venv/bin/activate  # This is different in Windows
pip install -r requirements.txt
streamlit run MoviesAnalysis.py
1 Like

Okay @Goyo Thanks for investing time in my issue🙌🏼…I’m looking into the matter to find the real cause of this problem

Is there any problem related to versions ?

I got an another error…maybe it is the only reason that my dependencies are not installing in cloud

How can the error that you are getting now be the cause of the error that you got hours ago?

I upgraded the tensoflow and streamlit version and got this new error…different packages demands different version of protobuf . I guess that’s why it’s showing that kind of error

You already had tensorflow-intel==2.12.0 installed before upgrading. What you probably didn’t have is the ancient protobuf==3.12.2, released three years ago.

Anyway, I don’t see how messing with the environment that works is going to help figure out what is wrong with the environment that doesn’t work. It is the latter that should have been fixed, not the former. The issue you are having now is most likely unrelated to the original one.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.