{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Define requirement boto3 clients" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import boto3\n", "\n", "sm_client = boto3.client(service_name=\"sagemaker\")\n", "runtime_sm_client = boto3.client(service_name=\"sagemaker-runtime\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Define endpoint name\n", "\n", "This endpoint is previously deployed and ready to test. Change the name here if you want to test your own endpoint." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "endpoint_name = \"\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Define input data\n", "\n", "The data here is consistent with the sample endpoint above. If you deployed with different dataset, copy the Data Wrangler input data here instead" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "payload_str = '5,166.0,72.0,19.0,175.0,25.8,0.587,51'\n", "payload = payload_str.encode()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "response = runtime_sm_client.invoke_endpoint(\n", " EndpointName=endpoint_name,\n", " ContentType=\"text/csv\",\n", "# Accept=\"text/csv\",\n", " Body=payload,\n", ")\n", "response[\"Body\"].read()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "instance_type": "ml.t3.medium", "kernelspec": { "display_name": "Python 3 (Data Science)", "language": "python", "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-2:429704687514:image/datascience-1.0" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 4 }