From 3e9f82b3ea838a1e2b95b6b1ed4ded61065d884d Mon Sep 17 00:00:00 2001 From: Maciej Czajka Date: Wed, 11 May 2022 18:51:12 +0200 Subject: [PATCH] update dockerfile, add predict.py, jenkinsfile_predict --- Dockerfile | 1 + Jenkinsfile_predict | 16 ++++++++++++++++ predict.py | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 Jenkinsfile_predict create mode 100644 predict.py diff --git a/Dockerfile b/Dockerfile index 9da913f..ca90a65 100755 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ COPY Biblioteka_DL/dllib.py . COPY Biblioteka_DL/dllib-sacred.py . COPY Biblioteka_DL/evaluate.py . COPY Biblioteka_DL/dllib-mlflow.py . +COPY predict.py . COPY Biblioteka_DL/all_games.csv . RUN ./download.sh $CUTOFF diff --git a/Jenkinsfile_predict b/Jenkinsfile_predict new file mode 100644 index 0000000..b15565a --- /dev/null +++ b/Jenkinsfile_predict @@ -0,0 +1,16 @@ +pipeline { + agent { + dockerfile { + additionalBuildArgs "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} --build-arg CUTOFF=${params.CUTOFF} -t maciejczajka" + } + } + + stages { + stage('Script') { + steps { + copyArtifacts filter: '*', projectName: 's444409-training/master', selector: lastSuccessful() + sh "python predict.py" + } + } + } +} \ No newline at end of file diff --git a/predict.py b/predict.py new file mode 100644 index 0000000..8e524f2 --- /dev/null +++ b/predict.py @@ -0,0 +1,16 @@ +import json +import mlflow +import pandas as pd + + +#logged_model = 'mlruns/1/d5b6f9c1784a4d2dbb8592cd4ad364d7/artifacts/model' +logged_model = 'mlruns/1/fa3e620f03e64d888c364827907fb6f5/artifacts/s444409' +loaded_model = mlflow.pyfunc.load_model(logged_model) + + +with open(f'{logged_model}/input_example.json') as f: + data = json.load(f) + input_example = pd.DataFrame(data['inputs'][0]) + + +loaded_model.predict(input_example) \ No newline at end of file