Industrial IoT/ML Workshop

Using the trained Model build in the Cloud

Now if you look inside the prediction function you see that the model is actually loaded from a file that is deployed with the prediction function instead of the one that is coming from S3. In order to load the model that was deployed from S3 do the following:

  • Open the PredictAnomalies lambda function in AWS Cloud9
  • Change the path to the model (the variable called modelDirectory) to point to /trained_model/
  • Upload the new code (similar to the step where you modified the OPCUA lambda function) by executing the following commands on the Cloud9 command line window:
    cd ~/environment/Lambda_Functions/
    ./ *Predict*

  • Remember to save your files once your are done editing the code and before you execute the script above
  • Deploy the Greengrass group again
  • Test if you still get the similar prediction output as shown below: