Analytics Vidhya
Published in

Analytics Vidhya

Deploy Machine Learning Model using Flask to Heroku — Beginners(Part 3)

This tutorial is part 3 and the final part of the guide on how to deploy Machine Learn Models using Flask to Heroku via GitHub.

  • The first part was a refresher on a logistic regression model on JupyterNotebook.
  • The second part was on how to structure your flask application and embed your machine learning model in it, as well as uploading the application on GitHub.
  • Our final part will be a guide on how to deploy your flask application from GitHub to Heroku.

Step 1: Creating a New App

From your Heroku dashboard click on New and then Create new app as shown below.

Enter your new app name and save changes by clicking on the Create app button.

Step 2: Connecting to GitHub

From the new create app on the Deploy section ,choose GitHub as your deployment method. You will need to allow Heroku to access GitHub when prompted. Once you have successfully connected to GitHub search for your repo-name and click connect on that repo.

Step3 : Deployment

On the manual deployment section, choose your branch, in this case our branch is the main branch, then click on Deploy Branch. This process could take up between 2 and 10 minutes depending on your internet speed. If your app was successfully deployed you will see a View button. In my case, View button takes me to https://joan-diabetes-predictor.herokuapp.com/

If the View button gives you the following error, don’t panic :)

Something could have gone wrong. In most cases it’s usually one of the following:

  1. Package versions not matching with those in Heroku. You can always downgrade.
  2. Missing Gunicorn package in your requirements.txt file.
  3. Missing out the Procfile, or wrong spelling of the file name. Confirm the command in it is also okay.

The View logs section will guide you on your error. When you fix your code, redeploy your branch once again.

That is the final part of the guide on how to create and deploy a machine learning model on Heroku using Flask via GitHub. Happy Coding !

--

--

--

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Recommended from Medium

The Method About Decreasing Vibration in Video With Two Ways: Simple Moving Average(SMA) and…

VGG16 -19 — best-performing ConvNet models in computer vision

Impact of dataset errors on model accuracy

computer image with handwritten and typed digits

TensorFlow Dev Summit 2020: Livestream Highlights

Combine Image & Tabular data in one Model using PyTorch

Bardvja Recommender System: A personal librarian for peer-reviewed articles

Personality prediction by social media using Natural Language Processing

Vascular Clog Loss Classification: An Advanced Alzheimer’s Research Using ConvNets

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joan Ngugi

Joan Ngugi

Big Data & Analytics, Data Science, Machine Learning, Data Engineering | ngugijoan.com

More from Medium

From Reddit to Data Science using Terality, with Python

NLP: Word2Vec with Python Example

Credit Card Fraud Detection (Python Codes included)

Introduction to Python Machine Learning and Dealing with NaN Values in a Data Set using Pandas