Update files

This commit is contained in:
Agata 2022-05-22 12:15:11 +02:00
parent 23e499fbf3
commit 8c6c96e62c
2 changed files with 20 additions and 0 deletions

View File

@ -9,6 +9,11 @@ pipeline {
description: 'Which build to use for copying artifacts', description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR' 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 { stages {
stage('Copy artifacts') { stage('Copy artifacts') {
@ -16,5 +21,11 @@ pipeline {
copyArtifacts fingerprintArtifacts: true, projectName: 's444421-training/training_and_evaluation', selector: buildParameter('BUILD_SELECTOR') 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'
}
}
} }
} }

9
predict_444501.py Normal file
View File

@ -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])