Created
October 16, 2019 17:03
-
-
Save aymericdelab/1b9febd0ca53714f7eb1bad9d4803f6d to your computer and use it in GitHub Desktop.
deployment on azure using a ACI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## deploy the model to the ACI (azure container instances) | |
from azureml.core.webservice import AciWebservice | |
from azureml.core.model import InferenceConfig | |
from azureml.core.webservice import Webservice | |
from azureml.core.model import Model | |
inference_config = InferenceConfig(runtime= "python", ## runtime for the image, either python or spark-py | |
entry_script="score.py", | |
conda_file="myenv.yml") ##dependencies | |
aciconfig = AciWebservice.deploy_configuration(cpu_cores=1, | |
auth_enabled=True, #True generates API keys to secure access | |
memory_gb=1, | |
tags={'name': 'founder-classifier', 'framework': 'tensorflow'}, | |
description='classify founders using CNN') | |
service = Model.deploy(workspace=ws, | |
name='founder-classifier-webservice', | |
models=[model], #registered model defined earlier | |
inference_config=inference_config, | |
deployment_config=aciconfig) | |
service.wait_for_deployment(True) | |
print(service.state) | |
print(service.scoring_uri) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment