This commit is contained in:
s444501 2022-05-13 03:21:39 +02:00
parent ff05e16b84
commit da4bd8e58c
2 changed files with 35 additions and 0 deletions

23
s444356-reg.Jenkinsfile Normal file
View File

@ -0,0 +1,23 @@
pipeline {
agent {
docker {
image 'zadanie'
args '-v /mlruns:/mlruns'
}
}
parameters {
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
}
stages {
stage('Prediction') {
steps {
sh 'python s444356-reg.py'
}
}
}
}

12
s444356-reg.py Normal file
View File

@ -0,0 +1,12 @@
import json
import mlflow
import numpy as np
path = '/mlruns/13/da5c6167bb45403fa35569849a1fbc13/artifacts/model'
model = mlflow.pyfunc.load_model(path)
with open(f'{path}/input_example.json') as file:
data = json.load(file)
input_example = np.array([data['inputs']]).reshape(-1, 2)
print('Input:\n', input_example)
print('Predictions:\n', model.predict(input_example))