Am unable to deploy the app on Streamlit cloud,

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! :wave:

Your requirements file is missing the .txt extension. Rename the file to requirements.txt

Best,
Snehan

https://abhishek183422-flower-classification-flr-zazif3.streamlitapp.com/

now am facing this issue

Hi @abhishek_chakraborty,

Looking at the error traceback in the app I can see you are using this line in your code:

model=keras.models.load_model('/Users/draculalemon/Downloads/Arduino-IRremote-master/Flower_prediction_50eph.h5')

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(
            local_path_where_model_will_be_saved,
            model_weights_url
)
model.load_weights(weights_path)

Hope that helps,

1 Like

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