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