navigate_before
CodeNOW Blog

Machine learning with CodeNOW

Technology

Great data apps to the cloud in 10 minutes with CodeNOW

Most data scientists spend a lot of time analyzing data and building models in Jupyter Notebooks but rarely take them to the next level where those machine-learning models are exposed through a custom, friendly web interface or via APIs. Four options coexist to productionalize models:

  1. Save yourself the hassle (don’t do anything).
  2. Figure it all out yourself (good luck learning JavaScript, React, HTTP, AWS product line, and whatnot).
  3. Have someone else figure it out for you (warning: $$$$ + 🧍🧍 involved).
  4. DIY but With A Little Big Help From My Friends Tooling (with the latest tools, a few $ and no extra 🧍).

This article is about the fourth option. We will show you how to use CodeNOW to quickly get a proof of concept in the hands of your users and get feedback to improve your model. You can leverage your Python and data skills and forget about the complexity associated with JavaScript, front-end frameworks, and cloud deployments:

  • Spend time on data-related tasks, e.g., improving data quality, model performance, or model accuracy. It is what you are good at.
  • Get your model deployed in a few minutes on your favorite cloud provider’s infrastructure.

CodeNOW will take care of disaster recovery, scaling, monitoring and logging, and many more mundane albeit necessary cloud operation tasks. And pick the cloud provider of your choice. You do not need to use the Google Cloud Platform just because you use Google Colab notebooks! CodeNOW is cloud agnostic and factors vendor lock-in out of the equation.

What we will build

Without further ado, let's implement and deploy what is often considered to be the Hello World application of machine learning. Given a set of inputs, our model will predict which type of flower the inputs most likely relate to. The model is based on the Iris data set. The Iris Dataset contains four features (length and width of sepals and petals) of 50 samples of three species of Iris (Iris setosa, Iris versicolor, and Iris virginica).

Iris setosaIris versicolorIris virginica

This is the user interface we are aiming at:

Prerequisites

  • You know Python (!) and Python’s data analysis and machine learning libraries (pandas, scikit-learn).
  • You know a little Markdown.
  • You know the basics of Git (commit and push operations).
  • Grab your CodeNOW account (or get your free trial account!).

Steps

We follow a five-step process. In what follows, we present a high-level overview. For a detailed overview, refer to our step-by-step video.

Step 1: Create a CodeNOW python scaffolder (< 5 mn)

  • Use the Docker Generic scaffolder.
  • Update the Dockerfile and requirements.txt files.

Step 2: Implement the user interface for your model

  • Put your code in the app.py file.
  • The code for this example can be found here.

Streamlit is a free and open-source ML tooling framework to create interactive ML tools. No JavaScript, no React. plain Python, and a ton of premade widgets.

Step 3: Test everything locally

  • In the src directory, run streamlit run app.py.
  • Check that the user interface is displayed and works as expected.

Step 4: Build & deploy the app in CodeNOW (< 5 mn)

  • Commit and push your changes.
  • Go to your CodeNOW instance.
  • Select your application then your Python component.
  • Build the component and deploy the application (check Deploy immediately after build).
  • Once build and deployment are successful, get the deployment URL.

Step 5: Tell your users about it!

  • Email the deployment URL to your target users.
  • Eagerly await their feedback!!!

Screencast: watch us do it in 5 mn

Want to learn more?

Did you manage to run the example? Let us know what you think!

If you want more data science examples using Python, the Data Professor YouTube channel by Prof. Nantasenamat contains many examples to learn from. You can for instance review this video from which we took the code for our Iris flower machine learning application.

How do you use Python? What examples would you like to see? Tell us!

Book a demo

Let's discuss the capabilities and benefits of CodeNOW for your company's specific needs.