From ff02751395653b8c7119e1d0f4ad84437042560d Mon Sep 17 00:00:00 2001 From: michalzareba Date: Sun, 23 May 2021 14:15:08 +0200 Subject: [PATCH] Add prediction from other student --- Jenkinsfile_predict | 23 +++++++++++++++++++++++ lab_09_predict.py | 15 +++++++++++++++ requirements.txt | 3 ++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile_predict create mode 100644 lab_09_predict.py diff --git a/Jenkinsfile_predict b/Jenkinsfile_predict new file mode 100644 index 0000000..0d11286 --- /dev/null +++ b/Jenkinsfile_predict @@ -0,0 +1,23 @@ +pipeline { + agent {dockerfile true} + parameters { + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR') + } + + stages { + stage('copyArtifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's434804-training', selector: buildParameter('BUILD_SELECTOR') + + } + } + stage('Predict example value'){ + steps { + 'sh 'python3 "./lab_09_predict.py"'' + } + } + } +} \ No newline at end of file diff --git a/lab_09_predict.py b/lab_09_predict.py new file mode 100644 index 0000000..333ffba --- /dev/null +++ b/lab_09_predict.py @@ -0,0 +1,15 @@ +import json +import mlflow +import pandas as pd + + +model = mlflow.keras.load_model("country_vaccination") + + +with open('country_vaccination/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)) diff --git a/requirements.txt b/requirements.txt index f093c02..09e3d59 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,5 @@ wget==3.2 gast==0.3.3 sacred==0.8.2 GitPython==3.1.14 -matplotlib==3.3.4 \ No newline at end of file +matplotlib==3.3.4 +mlflow==1.17.0 \ No newline at end of file