Created
October 3, 2018 14:42
-
-
Save mikeapted/67a8cbb77eda0d9b55a589bba1ffc5b3 to your computer and use it in GitHub Desktop.
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
import boto3 | |
import json | |
def lambda_handler(event, context): | |
payload = '1,13000 \n 1,20000 \n 2,3500 \n 2,5000 \n 3,3000 \n 3,3300 \n 4,2 \n 4,10' | |
endpoint_name = 'YourInitials-kmeans-anomalydetection' | |
runtime = boto3.client('runtime.sagemaker') | |
response = runtime.invoke_endpoint(EndpointName=endpoint_name, | |
ContentType='text/csv', | |
Body=payload) | |
result = json.loads(response['Body'].read().decode()) | |
for p in result['predictions']: | |
print (p) | |
return 'Complete' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment