Stack Overflow Asked by Manas Sambare on November 7, 2021
Overview:
I am trying to deploy a web app that uses OpenCV and Tensorflow to classify facial expression of a person. So a person uploads a picture and the app produces a bounding box around the face with the expression of the person. When I run the Streamlit app on my local machine, it works perfectly with the same requirements.txt. However, the app keeps crashing on Heroku.
Here is the output of the log:
2020-07-21T12:56:02.435384+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`
2020-07-21T12:56:05.484243+00:00 app[web.1]:
2020-07-21T12:56:05.484269+00:00 app[web.1]: Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.
2020-07-21T12:56:05.484271+00:00 app[web.1]: As a result, 'server.enableCORS' is being overridden to 'true'.
2020-07-21T12:56:05.484271+00:00 app[web.1]:
2020-07-21T12:56:05.484272+00:00 app[web.1]: More information:
2020-07-21T12:56:05.484272+00:00 app[web.1]: In order to protect against CSRF attacks, we send a cookie with each request.
2020-07-21T12:56:05.484273+00:00 app[web.1]: To do so, we must specify allowable origins, which places a restriction on
2020-07-21T12:56:05.484273+00:00 app[web.1]: cross-origin resource sharing.
2020-07-21T12:56:05.484273+00:00 app[web.1]:
2020-07-21T12:56:05.484274+00:00 app[web.1]: If cross origin resource sharing is required, please disable server.enableXsrfProtection.
2020-07-21T12:56:05.484279+00:00 app[web.1]:
2020-07-21T12:56:08.293129+00:00 app[web.1]:
2020-07-21T12:56:08.293160+00:00 app[web.1]: Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.
2020-07-21T12:56:08.293161+00:00 app[web.1]: As a result, 'server.enableCORS' is being overridden to 'true'.
2020-07-21T12:56:08.293161+00:00 app[web.1]:
2020-07-21T12:56:08.293163+00:00 app[web.1]: More information:
2020-07-21T12:56:08.293164+00:00 app[web.1]: In order to protect against CSRF attacks, we send a cookie with each request.
2020-07-21T12:56:08.293164+00:00 app[web.1]: To do so, we must specify allowable origins, which places a restriction on
2020-07-21T12:56:08.293164+00:00 app[web.1]: cross-origin resource sharing.
2020-07-21T12:56:08.293165+00:00 app[web.1]:
2020-07-21T12:56:08.293165+00:00 app[web.1]: If cross origin resource sharing is required, please disable server.enableXsrfProtection.
2020-07-21T12:56:08.293166+00:00 app[web.1]:
2020-07-21T12:56:08.485342+00:00 app[web.1]: libgcc_s.so.1 must be installed for pthread_cancel to work
2020-07-21T12:56:08.537947+00:00 heroku[web.1]: Process exited with status 134
2020-07-21T12:58:42.417606+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fer-2013.herokuapp.com request_id=ad34f9af-1463-49a4-b60d-21e642a793cd fwd="122.175.13.11" dyno= connect= service= status=503 bytes= protocol=https
2020-07-21T12:58:44.741839+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=fer-2013.herokuapp.com request_id=e483f00f-01e1-46f7-bc66-e8f1020c3638 fwd="122.175.13.11" dyno= connect= service= status=503 bytes= protocol=https
Here is the output for my Procfile:
web: sh setup.sh && streamlit run app.py
Here is the output of my setup.sh:
mkdir -p ~/.streamlit/
echo "
[server]n
headless = truen
port = $PORTn
enableCORS = falsen
n
" > ~/.streamlit/config.toml
Here is the link to the GitHub Repo:
https://github.com/Manas73/fer-2013
Turns out that I had opencv-python in my requirements.txt, I just replaced it with opencv-contrib-python-headless. It now works perfectly.
Answered by Manas Sambare on November 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP