Deploy your AI models using Serverless Containers

Workshop Resources

Table of Contents

  1. Prerequisites
  2. Learning Objective
  3. Steps
  4. Deploy with the CLI
  5. Deploy with the UI
  6. Verify the application
  7. Things you can try further

Prerequisites

Sign-up/Login to IBM Cloud

If you are an existing user please login to IBM Cloud

And if you are not, don't worry! We have got you covered! There are 3 steps to create your account on IBM Cloud:
1- Put your email and password.
2- You get a verification link with the registered email to verify your account.
3- Fill the personal information fields.
** Please make sure you select the country you are in when asked at any step of the registration process.

Screen Shot 2021-05-31 at 11 25 01 AM

Learning objective

This tutorial explains how to use the IBM Cloud Code Engine managed serverless platform system to deploy the Model Asset Exchange (MAX). Let's get started!

Prerequisites

If you are not familiar with the Model Asset Exchange, this introductory article provides a good overview.

Additionally, you need the following:

Estimated time

With the prerequisites available, it should take you approximately 20 minutes to complete this tutorial.

Steps

This tutorial shows you how to deploy MAX with Code Engine using two different methods:

  • IBM Cloud CLI
  • Code Engine GUI

Once you deploy MAX using either of these methods, you verify that you can use the application.

Deploy with the CLI

First, you need to create a project. Code Engine applications must be tied to a specific project.

  1. Open IBM Cloud Shell.

  2. Before running any Code Engine commands, target a resource group. (This will vary depending on your resource group name; mine is default.)

    ibmcloud target -g default
    
  3. Run the following command to create a Code Engine project:

    ibmcloud ce project create --name sandbox
    
  4. You should see output similar to the example below:

    ibmcloud ce project create --name sandbox
    Creating project 'sandbox'...
    ID for project 'sandbox' is 'f8445951-8d47-400c-9833-23e0d60a0811'.
    Waiting for project 'sandbox' to be active...
    Now selecting project 'sandbox'.
    OK
    
  5. Once you create the project, run the following command to deploy the MAX container as an application. (Note that the --image parameter points to an image registry, and the --port parameter overrides the default port (8080).)

    ibmcloud ce application create --name max-object-detector --image quay.io/codait/max-object-detector --port 5000
    
  6. You should see output similar to the example below:

    Creating application 'max-object-detector'...
    The Route is still working to reflect the latest desired specification.
    Configuration 'max-object-detector' is waiting for a Revision to become ready.
    Ingress has not yet been reconciled.
    Waiting for load balancer to be ready
    Run 'ibmcloud ce application get -n max-object-detector' to check the application status.
    OK
    https://max-object-detector.75asazy1s7n.us-south.codeengine.appdomain.cloud
    

Deploy with the GUI

The steps for deploying with the Code Engine GUI are as short as its CLI equivalent.

Go to the Code Engine overview page after logging into IBM Cloud. Enter quay.io/codait/max-object-detector into the Run a container image text box and click Start creating.

run a container image

On the next screen, create a new project, choose a region that is closest to you, give it a name, and select a resource group.

create a project

Once you create the project, you can configure the application. Choose the following options and click Create:

  • Application or Job: Select Application
  • Name: Enter a unique name
  • Project: Select the newly created project
  • Code to run: Select Container image
  • Image reference: Enter quay.io/codait/max-object-detector
  • Port: 5000

create a project

Verify the application

Once the application is deployed, you can view its details from the project view. To launch the application, click the Open application URL button on the top right of the screen.

Launch application

Remember to add /app at the end of the opened URL to use the application instead of the API.

Launch application

With Code Engine running the application, you can now interact with the web app by uploading a photo or using a web camera. Once analyzed, the MAX object detector will highlight common objects in the photo that was submitted.

Summary

This tutorial illustrates how to deploy a model container from the Model Asset Exchange to the cloud with IBM Cloud Code Engine by following two easy steps: creating a project and deploying the MAX application.

Reference Links

Done with the workshop? Here are some things you can try further

Authors