An easy way testing your model is to deploy the model in a container to an Azure Container Instance. A Container Instance is the easiest way to deploy a container.
Install the AzureML SDK
In your terminal install the AzureML SDK
pip install azureml-sdk
Download the scoring script
# Create a directory
mkdir deploy
cd deploy
# Download the scoring script
wget https://raw.githubusercontent.com/GlobalAICommunity/back-together-2021/main/workshop-assets/amls/score.py
Create the Python Script
We start with creating a python script called deploy.py, this script will take of deploying your model.
code deploy.py
and start with importing the dependencies and setting some variables.
import azureml
from azureml.core.model import Model, InferenceConfig
from azureml.core import Workspace, Model, Environment
from azureml.core.conda_dependencies import CondaDependencies
from azureml.core.webservice import AciWebservice
# Connect to workspace
workspaceName = ""
subscriptionId = ""
resourceGroup = ""
Next we need to connect to our workspace.
Get the subscription ID
The command below shows a list of all your subscription id's
az account show --query id -o table
Get the Workspace name
The command below lists all the workspaces you have access to