From fa12ee7e933dd689f4aabeca3fa8a7157e30f466 Mon Sep 17 00:00:00 2001 From: lx96 Date: Sat, 18 Nov 2023 17:55:01 +0000 Subject: [PATCH] submmit --- project-ml-microservice-kubernetes/app.py | 7 ++++++- .../output_txt_files/docker_out.txt | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/project-ml-microservice-kubernetes/app.py b/project-ml-microservice-kubernetes/app.py index 7d583b72e5..730ef514c5 100644 --- a/project-ml-microservice-kubernetes/app.py +++ b/project-ml-microservice-kubernetes/app.py @@ -1,4 +1,8 @@ -from flask import Flask, request, jsonify +from flask import ( + Flask, + request, + jsonify + ) from flask.logging import create_logger import logging @@ -63,6 +67,7 @@ def predict(): # get an output prediction from the pretrained model, clf prediction = list(clf.predict(scaled_payload)) # TO DO: Log the output prediction value + LOG.info(f'prediction value: {prediction}') return jsonify({'prediction': prediction}) if __name__ == "__main__": diff --git a/project-ml-microservice-kubernetes/output_txt_files/docker_out.txt b/project-ml-microservice-kubernetes/output_txt_files/docker_out.txt index a5d547f2a7..4e12d1e8f6 100644 --- a/project-ml-microservice-kubernetes/output_txt_files/docker_out.txt +++ b/project-ml-microservice-kubernetes/output_txt_files/docker_out.txt @@ -1,10 +1,10 @@ - -[2023-11-18 08:50:23,684] INFO in app: JSON payload: +[2023-11-18 17:43:35,145] INFO in app: JSON payload: {'CHAS': {'0': 0}, 'RM': {'0': 6.575}, 'TAX': {'0': 296.0}, 'PTRATIO': {'0': 15.3}, 'B': {'0': 396.9}, 'LSTAT': {'0': 4.98}} -[2023-11-18 08:50:23,695] INFO in app: Inference payload DataFrame: +[2023-11-18 17:43:35,157] INFO in app: Inference payload DataFrame: CHAS RM TAX PTRATIO B LSTAT 0 0 6.575 296.0 15.3 396.9 4.98 -[2023-11-18 08:50:23,703] INFO in app: Scaling Payload: +[2023-11-18 17:43:35,165] INFO in app: Scaling Payload: CHAS RM TAX PTRATIO B LSTAT 0 0 6.575 296.0 15.3 396.9 4.98 -172.17.0.1 - - [18/Nov/2023 08:50:23] "POST /predict HTTP/1.1" 200 - \ No newline at end of file +[2023-11-18 17:43:35,168] INFO in app: prediction value: [20.35373177134412] +172.17.0.1 - - [18/Nov/2023 17:43:35] "POST /predict HTTP/1.1" 200 - \ No newline at end of file