Let's deploy the model!

This is the last part of my small project to get an app running, which will take an image as input, extract the text and then run a deep learning model on it to give the book a rating based on my book taste. In part 3 we put together the parts we need to create our web app with binder and voila.

The final project you'll find in my git repo. This blogpost should guide you through the git repo, what to do to build your web app from a jupyter notebook. Ok, so let's get started!

image info

Alright, what have we got here? First of all, the jupyter notebook from part 3. So nothing new here. We have a LICENSE and a README file, which aren't that important. What's next is important, the three files "app.yml", "apt.txt" and "requirements.txt". Let's start with "requirements.txt".

image info

In the "requirements.txt" are all the packages we need for our project. Binder will create a docker container for us, so it needs to know what packages are required. Next, let's have a look at "apt.txt".

image info

This one is moderatly more difficult. Especially if you do haven't worked with docker before. It looks like the requirement file, however what this does is it apt installs these packages. This is required, because pytesseract works different from other packages. Without this file our jupyter notebook won't be able to connect to pytesseract. I had a lot of head scratching and googling to do before I found out that tesseract needs to be installed that way to find the path where its libraries are.

Next, let's look at app.yml.

image info

This file is needed to that we can make use of voila. Voila takes all the non html Output, runs it in the background and doesn't show it to the user of the app.

Ok, we're finally able to start our web app on Binder.

image info

So we simply specify the path to our git repository and type "/voila/render/App-with-Voila-mybinder.ipynb" into the URL to open. Then instead of "File" we use "URL".

Ok, let Binder do its work and set up a docker container for us, on which our app is running. When Binder creates the docker container for the project for the first time, this will take a while (5 min or so).

Let's have a look at the running app.

image info

Let's uploade an image and see what my algorithm will say how much I will like this book:

image info

Awesome! That looks great (btw. the book was the sea wolf by Jack London and I loved this book). Now everyone can use this little web app and see whether I would recommend this book or not. Simply click on the "launch binder" in my git repo and start the app. I hope you enjoyed this little project as much as I did and stay tuned for more.

Lasse