Join thousands of AI enthusiasts and experts at the Learn AI Community.

Publication

Machine Learning   Programming

Deploy Machine Learning Web Apps for Free

Last Updated on January 6, 2023 by Editorial Team

Author(s): Aniket Maurya

Machine Learning, Programming

In this tutorial, I will explain how to deploy any Python web app on Herokuย cloud.

Photo by Kevin Ku onย Unsplash

Deploying a Machine Learning model is a difficult task due to the requirement of large memory and powerful computation. This tutorial focuses on a simple deployment technique that can be used to deploy any Python web app forย free.

Read my previous article to learn how to build an โ€œImage classification web app with FastAPI and Tensorflowโ€

I have also created a YouTube tutorial on Deploying Python app onย Heroku

First of all, you will need a Heroku id, so go now and register for a freeย account.

For deploying any Python app on Heroku, we need three files- requirements.txt, runtime.txt, and Procfile.

  • requirements.txt is a normal text file that contains Python packages required to run theย app.
  • runtime.txt is a text file that will contain the Python Version you want your app to runย on.
  • Procfile is will contain the command to launch your web app. For example, you canย use
# method 1
python application/server/main.py
# or uvicorn if you are deploying a uvicorn server
uvicorn application.server.main:app

Go to your Heroku dashboard then click on New and create a newย app

Enter your App name and select the Server region that is nearest to your location and click on Createย app

After you create the app, you will see the deployment methodsโ€Šโ€”โ€ŠHeroku Git, GitHub, and Container Registry. I will use the GitHub method. For this just push your code repository to your GitHub account and then connect to GitHub onย Heroku.

Then search the repository and connect it to your Herokuย app.

After this, you will see a deploy button, select the branch of your Git repository that you want to be deployed, and click onย deploy.

Then Heroku will automatically start your deployment ๐ŸŽ‰๐ŸŽ‰
After deployment, you can access your app from any web browserย ๐Ÿ”ฅ

Hope this article helped you in the deployment of your web app. If you have some feedback or suggestion please let me know in the commentย section.

Follow me on Twitter: https://twitter.com/aniketmaurya

Subscribe to my YouTube channel: https://www.youtube.com/channel/UCRuFsj94hWecPkuEr4f5Xww


Deploy Machine Learning Web Apps for Free was originally published in Towards AIโ€Šโ€”โ€ŠMultidisciplinary Science Journal on Medium, where people are continuing the conversation by highlighting and responding to this story.

Published via Towards AI

Feedback โ†“