DEPLOYING DEEP LEARNING MODEL AS A WEB APP

krishna katyal
3 min readApr 7, 2019

--

IF you are into deep learning then fast.ai is no new name Jeremy Howard is not only a brilliant teacher but also excellent experimentalist and promotes the same in this excellent course. The fastai MOOC, forum and the library has not only helped in attaining state of the art results but also helped thousands of AI enthusiastic to kick start their AI journey.

In the Practical Deep Learning for Coders, v3 Provided by Fast.ai several services are described for production such as:

  • Amazon SageMaker
  • AWS Elastic Beanstalk
  • Microsoft Azure Functions
  • Render
  • Google App Engine

We will deploy our deep learning model using Render, Render is a modern cloud provider that makes it trivial and instant to deploy your code in production. You can deploy anything on Render, from simple static sites and cron jobs to databases and Dockerized private services.

Render deploys your services directly from GitHub. All that’s needed is to push your code like you normally do — Render automatically updates your services and keeps them up and running at all times.

KEY FEATURES OF RENDER:

1>Fast CDN.

2>Automatic continuous deploys from git.

3>Custom domains with fully managed SSL.

4>Unlimited collaborators.

5>The http/2 and brotli compression.

STEPS TO CREATE THE APPLICATION:

1>Train you model
2>Sign up at render using invite code fastai-v3
3>Upload the trained model file created with learner.export to a cloud service like google drive or Dropbox. copy the download link for the file.

5>Edit the file server.py inside the app directory and update the model_file_url variable with the URL copied in the third step
6>In the same file, update the line classes with the classes you expect from your model.

DEPLOYING THE APPLICATION:

Create a new web service on render and use the repository you created earlier, grant render the permission of accessing the repository.On the deployment screen name, your service and docker is used as the container the URL will be created using the service name. the service name can be changed, but the URL once created can’t be edited further.
Click save web service. that’s it! your service will begin building and should be live in a few minutes at the URL displayed in your render dashboard. you can check its progress in the deploy logs.

Testing of app:

OUR WEB APPLICATION IS READY

Your app’s URL will look like https://service-xyz.onrender.com. you can also monitor the service logs as you test your app.

Local testing
To run the app server locally, run this command in your terminal:
python app/server.py serve

--

--