diff --git a/cloud-functions/python/functions/sample_classification.py b/cloud-functions/python/functions/sample_classification.py index 84aed14..bf662b1 100644 --- a/cloud-functions/python/functions/sample_classification.py +++ b/cloud-functions/python/functions/sample_classification.py @@ -9,3 +9,15 @@ def sample_classification(event, context): print(f"Function triggered by change to: {resource_string}.") # now print out the entire event object print(str(event)) + + with open('label_encoder.pkl', 'rb') as label_encoder_file: + loaded_label_encoder = pickle.load(label_encoder_file) + + with open('gaussian_naive_bayes_model.pkl', 'rb') as model_file: + loaded_model = pickle.load(model_file) + + input_data = pd.DataFrame({'calculatedRatio': 0.231057205, 'deviceRatio': 0.231057205,'led1Buffer': 23776.33, 'led2Buffer': 26401.67, + 'led1Sample': 16286, 'led2Sample': 6952.67}, index=[0]) + + predicted_result = loaded_model.predict(new_data) + print(predicted_result.item()) \ No newline at end of file