[Guide] How do deploy app from Lesson 2 on Heroku

Hi guys,

I just wanted to share my approach on how to create a simple bear prediction app (or any other image prediction app) on a free hosting service.
I mean the app that is thoroughly explained in Lesson 2: https://course.fast.ai/videos/?lesson=2
I found that Heroku allows set up one app for free, so I decided to take advantage of that.

ALERT: I do not know Python, so if you see silly things in my code, just let me know.
I will happily accept any suggestions.

Essentially my approach was to combine these two guides:
https://course.fast.ai/deployment_render.html
https://github.com/javismiles/bear-detector-flask-deploy

The second app was based on Flask, which is much easier to understand, especially considering my lack of Python knowledge.
However, it used fastai2, which I did not know how to get to work.

The render app is based on Starlette, which I couldn’t really grasp (remember my Python arrogance), but the part related to prediction was based on fastai, so I have incorporated its logic into Flask app and made it work on Heroku.

OK, let’s see how to get it working. There are several steps:

  1. Create an account on Heroku.com and choose the free option there.
  2. You need an account on GitHub.com, so you could fork my repo to your own account.
    My repo is here: https://github.com/tony-sologubov/bear-detector-on-heroku
  3. Fork my repo to your GitHub account and set up Heroku to use this repo for the server.
    For that choose ‘Deployment method’ as ‘GitHub’. Specify the ‘Connect to GitHub’ setting as your GitHub account and then find your repository there.
  4. Finally, scroll down to the ‘Manual deploy’ button and click the ‘Deploy Branch’ button. It will take quite a bit of time, but the app will finally be launched. If not, check logs and let me know what went wrong.

I hope you find this simple tutorial useful and if you have any comments, I will happy to hear from you.

Cheers,

Tony

3 Likes

thanks Tony it works like a charm and it is free.

Hey so I created my own app and deployed it thanks to your method but the application is failing and the logs imply that it fails on the load_learner methods and because I created my model using kaggle. The full explanation is here if you’d like to help.

1 Like

Deployed my cat detector app (for free) using Heroku as well, see deployment folder in my github page: https://github.com/rouenlee29/cat-detector

Deployed my pokemon classifer on Heroku
https://pokemonclassifierapp.herokuapp.com/

What is the purpose of the resources/tmp folder? What does it do?

Edit: Never mind, I understand it is for storing end user uploaded image.

1 Like

How to Deploy Fast.ai Models? (Voilà , Binder and Heroku)

I wrote a medium article. I hope this may help.