I am trying to deploy an app using Streamlit, the app is running fine locally, but when am trying to deploy it on Streamlit cloud its showing no moduel name cv2 error, and I have to idea how to resolve this, a step by step guide will be highly appreciated.
here the main code.
Hi @abhishek_chakraborty, welcome to the community!
Your requirements file is missing the
.txt extension. Rename the file to
Looking at the error traceback in the app I can see you are using this line in your code:
The problem is that the model path used above is a local path on your machine. It points nowhere when deployed on Cloud!
When deploying your app on Cloud, you should instead:
- either also upload your model weights (the .h5 file) in your GitHub repository + update the path so it points to the correct location (a relative path).
- or host this .h5 file elsewhere, get its URL and pass it like in the following:
from keras.utils.data_utils import get_file
weights_path = get_file(
Hope that helps,