Skip to content

Commit

Permalink
Fix: mosaic-onnx sample for ONNX InferenceService (kubeflow#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuka137 authored Dec 17, 2020
1 parent 6b953eb commit 121e3dd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/samples/v1alpha2/onnx/mosaic-onnx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
],
"source": [
"%%bash\n",
"echo \"model name: $MODEL_NAME\"\n",
"echo \"service url: $SERVICE_HOSTNAME\"\n",
"echo \"cluster ip: $CLUSTER_IP\""
"echo \"ingress ip: $INGRESS_HOST\"\n",
"echo \"ingress port: $INGRESS_PORT\""
]
},
{
Expand All @@ -57,10 +57,11 @@
"source": [
"# if you dont see values above, see instructions in the readme and replace the values here!\n",
"import os\n",
"model_name = os.environ[\"MODEL_NAME\"]\n",
"model_name = \"default\"\n",
"service_hostname = os.environ[\"SERVICE_HOSTNAME\"]\n",
"cluster_ip = os.environ[\"CLUSTER_IP\"]\n",
"predictor_url = \"http://%s/v1/models/%s:predict\" % (cluster_ip, model_name)\n",
"ingress_ip = os.environ[\"INGRESS_HOST\"]\n",
"ingress_port = os.environ[\"INGRESS_PORT\"]\n",
"predictor_url = \"http://%s:%s/v1/models/default:predict\" % (ingress_ip, ingress_port)\n",
"predictor_url"
]
},
Expand Down Expand Up @@ -98,7 +99,7 @@
"source": [
"# load & resize image\n",
"image = Image.open(\"image.jpg\")\n",
"image = image.resize((244,244), Image.ANTIALIAS)\n",
"image = image.resize((224,224), Image.ANTIALIAS)\n",
"image"
]
},
Expand Down Expand Up @@ -171,7 +172,7 @@
"# Parse response message\n",
"response_message = json_format.Parse(response.text, predict_pb2.PredictResponse())\n",
"output1 = np.frombuffer(response_message.outputs['output1'].raw_data, dtype=np.float32)\n",
"output1 = output1.reshape(3,244,244)"
"output1 = output1.reshape(3,224,224)"
]
},
{
Expand Down Expand Up @@ -216,7 +217,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.0"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 121e3dd

Please sign in to comment.