Skip to content

Commit

Permalink
fix inference demo_pipeline_standalone_kfp
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaquinRivesGambin committed Apr 23, 2024
1 parent 5392e47 commit 7b7e29d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tutorials/demo_notebooks/demo_pipeline/demo-pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@
" logger.info(f\"\\nInference service URL:\\n{is_url}\\n\")\n",
"\n",
" inference_input = {\n",
" 'instances': input_sample.tolist()\n",
" }\n",
" 'instances': input_sample.tolist()\n",
" }\n",
" response = requests.post(\n",
" is_url,\n",
" json=inference_input,\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@
" logger = logging.getLogger(__name__)\n",
"\n",
" namespace = 'kserve-inference'\n",
"\n",
" \n",
" input_sample = [[5.6, 0.54, 0.04, 1.7, 0.049, 5, 13, 0.9942, 3.72, 0.58, 11.4],\n",
" [11.3, 0.34, 0.45, 2, 0.082, 6, 15, 0.9988, 2.94, 0.66, 9.2]]\n",
"\n",
Expand All @@ -511,17 +511,24 @@
" KServe.get(model_name, namespace=namespace, watch=True, timeout_seconds=120)\n",
"\n",
" inference_service = KServe.get(model_name, namespace=namespace)\n",
" is_url = inference_service['status']['address']['url']\n",
"\n",
" header = {\"Host\": f\"{model_name}.{namespace}.example.com\"}\n",
" is_url = f\"http://istio-ingressgateway.istio-system.svc.cluster.local:80/v1/models/{model_name}:predict\"\n",
" \n",
" logger.info(f\"\\nInference service status:\\n{inference_service['status']}\")\n",
" logger.info(f\"\\nInference service URL:\\n{is_url}\\n\")\n",
"\n",
" inference_input = {\n",
" 'instances': input_sample.tolist()\n",
" }\n",
"\n",
" response = requests.post(is_url, json=inference_input)\n",
" logger.info(f\"\\nPrediction response:\\n{response.text}\\n\")"
" 'instances': input_sample.tolist()\n",
" }\n",
" response = requests.post(\n",
" is_url,\n",
" json=inference_input,\n",
" headers=header,\n",
" )\n",
" if response.status_code != 200:\n",
" raise RuntimeError(f\"HTTP status code '{response.status_code}': {response.json()}\")\n",
" \n",
" logger.info(f\"\\nPrediction response:\\n{response.json()}\\n\")"
],
"outputs": [],
"execution_count": null
Expand Down

0 comments on commit 7b7e29d

Please sign in to comment.