Deep Learning Deployment Basics - Neural Network Web Apps

Deep Learning Course - Level: Intermediate

Deploy Keras Neural Network to Flask web service | Part 1 - Overview

video

expand_more chevron_left

text

expand_more chevron_left

Intro to Keras Neural Network Deployment with Flask

Over the next several episodes, we'll be working to deploy a Keras model to a Flask web service.

In this episode, we're going to discuss what this means and why we'd want to do this. We'll also get a glimpse of what the final product will look like. Let's get to it!

What does it mean to deploy a model?

We're going to be working to deploy a Keras model to a web service... But what exactly does this mean? Deploying to a web service? Why would we do it anyway?

Well, so far in this series, anytime we've built a model, trained a model, or used a model for inference, it's been within a Jupyter notebook, right? That's totally fine... For testing and developing purposes.

What about after we have a satisfactory model though, and we want to use it or access it from an app?

neural network diagram

Well, we're not going to be using Jupyter notebook to do that. We can't access a model in a Jupyter notebook from an outside app. What if our app isn't even written in Python? What will we use in that case?

One very viable option is to use a web service. This means apps that we build that need to use our models, regardless of which language they're written in, will be able to access the models over the web using HTTP.

So, we'll be moving a Keras model to a web service, i.e. deploying it to a web service, and once that's done, we'll be able to access and utilize our model over HTTP from other apps, and we'll even see how we can interact with our model from the browser.

The model we'll use is the fine-tuned VGG16 model that we worked with earlier in this series to predict on images of cats and dogs, but the steps we go through together for this can be used for whatever model you choose to work with.

Project overview

Our end goal will be to deploy the trained model to a Flask web service. Then from the browser, we'll send an image of a cat or dog to the web service, and have it respond with the model's predictions.

Curious how that might look? Let's check it out.

This is a very simple, no frills web app I created. From this page, we can choose an image of a cat or dog, press the predict button, and get predictions. See the corresponding video for the full demo.

What's actually happening is that this web app, written in HTML and Javascript, is making an HTTP call to a Flask web service, which is written in Python. By making an HTTP call, I mean that we're calling on the web service to do something for us. We also refer to this as an HTTP request.

Now, this web service is hosting our VGG16 model, and when we call it, we're requesting for it to send us back a prediction from our model for the given image that we send it. Once we receive that response, we display it on our web page.

This is what we're going to be building together. We'll develop the front end, which we'll refer to as the web app, and we'll also develop the backend, which will be the Flask web service.

As mentioned earlier, the backend will be written in Python, which you should already be comfortable with since you're working with Keras. The frontend will be written in HTML and Javascript. If you're not already familiar with these, it won't be a problem.

Generally, you can think of HTML as the language that provides the structure of the webpage, and Javascript as the language that all the logic is written in. We'll be going step by step in the code stating the intention for each line, so don't worry.

Something that's cool is, even though the app we're building to call the backend web service will be a web app, the web service will be able to be called by any app using an HTTP request, regardless of what language the app is in.

We'll kick off our next episode by getting ourselves familiar with Flask and installing it. Until then, let me know in the comments if you'll be following along with this project. See ya there!

quiz

expand_more chevron_left
deeplizard logo DEEPLIZARD Message notifications

Quiz Results

resources

expand_more chevron_left
Over the next several videos, we'll be working to deploy a Keras model to a Flask web service. In this first video, we're going to discuss what this means and why we'd want to do this. We'll also get a glimpse of what the final product will look like. The model we'll use is the fine-tuned VGG16 image classifier that we worked with earlier in this playlist to predict on images of cats and dogs, but the steps we go through together for this can be used for whatever model you choose to work with. Once we've deployed our Keras model to the web service, we'll be able to access our model over HTTP from other apps, and we'll even see how we can interact with our model from the browser. Our end goal will be to deploy the trained model to a Flask web service, and then from the browser, send an image of a cat or dog to the web service, and have it respond with the model's predictions. πŸ•’πŸ¦Ž VIDEO SECTIONS πŸ¦ŽπŸ•’ 00:00 Welcome to DEEPLIZARD - Go to deeplizard.com for learning resources 00:30 Help deeplizard add video timestamps - See example in the description 04:00 Collective Intelligence and the DEEPLIZARD HIVEMIND πŸ’₯🦎 DEEPLIZARD COMMUNITY RESOURCES 🦎πŸ’₯ πŸ‘‹ Hey, we're Chris and Mandy, the creators of deeplizard! πŸ‘€ CHECK OUT OUR VLOG: πŸ”— https://youtube.com/deeplizardvlog πŸ’ͺ CHECK OUT OUR FITNESS CHANNEL: πŸ”— https://www.youtube.com/channel/UCdCxHNCexDrAx78VfAuyKiA 🧠 Use code DEEPLIZARD at checkout to receive 15% off your first Neurohacker order: πŸ”— https://neurohacker.com/shop?rfsn=6488344.d171c6 ❀️🦎 Special thanks to the following polymaths of the deeplizard hivemind: Mano Prime πŸ‘€ Follow deeplizard: Our vlog: https://youtube.com/deeplizardvlog Fitness: https://www.youtube.com/channel/UCdCxHNCexDrAx78VfAuyKiA Facebook: https://facebook.com/deeplizard Instagram: https://instagram.com/deeplizard Twitter: https://twitter.com/deeplizard Patreon: https://patreon.com/deeplizard YouTube: https://youtube.com/deeplizard πŸŽ“ Deep Learning with deeplizard: AI Art for Beginners - https://deeplizard.com/course/sdcpailzrd Deep Learning Dictionary - https://deeplizard.com/course/ddcpailzrd Deep Learning Fundamentals - https://deeplizard.com/course/dlcpailzrd Learn TensorFlow - https://deeplizard.com/course/tfcpailzrd Learn PyTorch - https://deeplizard.com/course/ptcpailzrd Natural Language Processing - https://deeplizard.com/course/txtcpailzrd Reinforcement Learning - https://deeplizard.com/course/rlcpailzrd Generative Adversarial Networks - https://deeplizard.com/course/gacpailzrd Stable Diffusion Masterclass - https://deeplizard.com/course/dicpailzrd πŸŽ“ Other Courses: DL Fundamentals Classic - https://deeplizard.com/learn/video/gZmobeGL0Yg Deep Learning Deployment - https://deeplizard.com/learn/video/SI1hVGvbbZ4 Data Science - https://deeplizard.com/learn/video/d11chG7Z-xk Trading - https://deeplizard.com/learn/video/ZpfCK_uHL9Y πŸ›’ Check out products deeplizard recommends on Amazon: πŸ”— https://amazon.com/shop/deeplizard πŸ“• Get a FREE 30-day Audible trial and 2 FREE audio books using deeplizard's link: πŸ”— https://amzn.to/2yoqWRn 🎡 deeplizard uses music by Kevin MacLeod πŸ”— https://youtube.com/channel/UCSZXFhRIx6b0dFX3xS8L1yQ ❀️ Please use the knowledge gained from deeplizard content for good, not evil.

updates

expand_more chevron_left
deeplizard logo DEEPLIZARD Message notifications

Update history for this page

Did you know you that deeplizard content is regularly updated and maintained?

  • Updated
  • Maintained

Spot something that needs to be updated? Don't hesitate to let us know. We'll fix it!


All relevant updates for the content on this page are listed below.