playing around
This commit is contained in:
@@ -6,10 +6,11 @@ print('SDK version' + azureml.core.VERSION)
|
||||
|
||||
# PREREQ: load workspace info
|
||||
# import azureml.core
|
||||
#region load-workspace
|
||||
|
||||
# <load>
|
||||
from azureml.core import Workspace
|
||||
ws = Workspace.from_config()
|
||||
#endregion
|
||||
# </load>
|
||||
|
||||
scorepy_content = "import json\nimport numpy as np\nimport os\nimport pickle\nfrom sklearn.externals import joblib\nfrom sklearn.linear_model import LogisticRegression\n\nfrom azureml.core.model import Model\n\ndef init():\n global model\n # retreive the path to the model file using the model name\n model_path = Model.get_model_path('sklearn_mnist')\n model = joblib.load(model_path)\n\ndef run(raw_data):\n data = np.array(json.loads(raw_data)['data'])\n # make prediction\n y_hat = model.predict(data)\n return json.dumps(y_hat.tolist())"
|
||||
print(scorepy_content)
|
||||
@@ -26,7 +27,7 @@ myenv.add_conda_package("scikit-learn")
|
||||
with open("myenv.yml","w") as f:
|
||||
f.write(myenv.serialize_to_string())
|
||||
|
||||
#Region config-image
|
||||
#<config-image?
|
||||
from azureml.core.image import ContainerImage
|
||||
|
||||
image_config = ContainerImage.image_configuration(execution_script = "score.py",
|
||||
@@ -35,7 +36,7 @@ image_config = ContainerImage.image_configuration(execution_script = "score.py",
|
||||
description = "Image with mnist model",
|
||||
tags = {"data": "mnist", "type": "classification"}
|
||||
)
|
||||
#End Region
|
||||
#</config-image>
|
||||
|
||||
# <config-aci>
|
||||
from azureml.core.webservice import AciWebservice
|
||||
|
||||
Reference in New Issue
Block a user