diff --git a/learning/Jenkinsfile b/learning/Jenkinsfile index 50d6010..43b5ef5 100644 --- a/learning/Jenkinsfile +++ b/learning/Jenkinsfile @@ -21,10 +21,8 @@ pipeline { stage('learning') { steps { sh 'python ./learning/ml.py' - sh "python ./learning/ml-mlflow.py" sh "export MLFLOW_TRACKING_URI=http://172.17.0.1:5000" sh "python ./learning/ml-mlflow.py" - sh "ls -l" } } stage('archiveArtifacts') { diff --git a/predict/Jenkinsfile b/predict/Jenkinsfile index 0af170a..8f2dc07 100644 --- a/predict/Jenkinsfile +++ b/predict/Jenkinsfile @@ -17,6 +17,7 @@ pipeline { sh 'ls -l' sh 'ls -l ./prediction_data' sh 'ls -l ./prediction_data/movies_imdb' + sh 'python ./predict.py' } } } diff --git a/predict/predict.py b/predict/predict.py index e69de29..696c8fb 100644 --- a/predict/predict.py +++ b/predict/predict.py @@ -0,0 +1,15 @@ +import json +import mlflow +import pandas as pd + + +model = mlflow.keras.load_model("./prediction_data/movies_imdb/MLmodel") + + +with open('./prediction_data/movies_imdb/input_example.json', 'r') as datafile: + data = json.load(datafile) + example_input = data["inputs"] + +input_dictionary = {i: x for i, x in enumerate(example_input)} +input_ex = pd.DataFrame(input_dictionary, index=[0]) +print(model.predict(input_ex))