Home > OS >  Difficulty in deploying ML model to Heroku
Difficulty in deploying ML model to Heroku

Time:03-22

Any help would be much appreciated. I created a repository here where all files are linked. I'm currently trying to learn how to deploy an ML model to Heroku. This is a pretty simple model and I was following along with a YouTube tutorial. When I run 'python app.py' on my terminal, the local server does run correctly, showing the exact interface I want.

When trying to deploy it on Heroku, I linked my GitHub repository and selected 'Deploy Branch'; Here, Heroku states that the app was successfully deployed. HOWEVER, when I then try to view, a page comes up stating Application Error.

As mentioned, I'm really not sure what's going wrong and would appreciate any guidance to get this working – I'd like to deploy other ML models I've been working on and getting this preliminary one running would be a huge help. Any advice?

Thanks!

CodePudding user response:

It seems like you have forgotten to create the Procfile. This is necessary for Heroku as it tells Heroku how to startup your application on it's servers.

Since you're server file is app.py and the Flask app is app as well, the following would be the contents of the Procfile

web: gunicorn app:app

Also update your requirements.txt file by adding gunicorn, as an example what i had was gunicorn==20.1.0

For more information about the Procfile see https://devcenter.heroku.com/articles/procfile

I have deployed this personally and it works fine now

  • Related