From 8c6c96e62c874ccc798d7d8087a186a51364c039 Mon Sep 17 00:00:00 2001 From: Agata Date: Sun, 22 May 2022 12:15:11 +0200 Subject: [PATCH] Update files --- predict_444501.Jenkinsfile | 11 +++++++++++ predict_444501.py | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 predict_444501.py diff --git a/predict_444501.Jenkinsfile b/predict_444501.Jenkinsfile index df38b46..238e060 100644 --- a/predict_444501.Jenkinsfile +++ b/predict_444501.Jenkinsfile @@ -9,6 +9,11 @@ pipeline { description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR' ) + string( + defaultValue: '{\\"inputs\\": [[167.39999389648438, 72.18000030517578, 40.0, 21.0, 94.0], [162.3000030517578, 67.30000305175781, 18.0, 52.0, 219.0], [178.5, 90.5, 14.699999809265137, 45.0, 262.0], [180.89999389648438, 77.0999984741211, 25.399999618530273, 43.0, 224.0], [177.3000030517578, 88.4800033569336, 35.599998474121094, 18.0, 183.0]]}', + description: 'Inputs', + name: 'INPUT' + ) } stages { stage('Copy artifacts') { @@ -16,5 +21,11 @@ pipeline { copyArtifacts fingerprintArtifacts: true, projectName: 's444421-training/training_and_evaluation', selector: buildParameter('BUILD_SELECTOR') } } + stage('Predict') { + steps { + sh 'echo ${params.INPUT} > input_example.json' + sh 'python predict_444501.py $INPUT' + } + } } } diff --git a/predict_444501.py b/predict_444501.py new file mode 100644 index 0000000..6e684af --- /dev/null +++ b/predict_444501.py @@ -0,0 +1,9 @@ +import mlflow +import numpy as np + +model = mlflow.pyfunc.load_model('/mlruns/1/e435ee5c0c5a468c99eb43c13df4a94b/artifacts/s444421') + +with open('input_example.json') as f: + input = json.load(f) + y_predicted = model.predict(np.array([data['inputs']]).reshape(-1, 2)) + print(y_predicted[:5]) \ No newline at end of file