Real-time inference
If you remember, earlier in this chapter, we added a placeholder in our decoding lambda code. That was specifically placed to allow us to leverage the model endpoint as real-time data is processed. The following set of code can now be added to reference our endpoint and evaluate incoming data:
### run against the model to calculate an anomaly score. data = {"current":str(event["current"])} payload = data['current'] print("payload: ", type(payload), payload) runtime= boto3.client('runtime.SageMaker') response = runtime.invoke_endpoint(EndpointName="current-rcf-2022-09-26-06-56", ContentType='text/csv', Accept='application/json', Body=payload) print(response) result = json.loads(response['Body'].read().decode...