prediction registry
This commit is contained in:
parent
d4dc3c23b2
commit
87bcdc7d4c
16
lab8/Jenkinsfile.mlflow
Normal file
16
lab8/Jenkinsfile.mlflow
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'mikolajk/ium:latest'
|
||||||
|
args '-v /mlruns:/mlruns'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Stage') {
|
||||||
|
steps {
|
||||||
|
sh 'cd lab8'
|
||||||
|
sh "python predictMlflow.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
lab8/predictMlflow.py
Normal file
15
lab8/predictMlflow.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import mlflow
|
||||||
|
import numpy as np
|
||||||
|
import json
|
||||||
|
|
||||||
|
logged_model = '/mlruns/14/80fe21a0804844088147d15a3cebb3e5/artifacts/lego-model'
|
||||||
|
|
||||||
|
# Load model as a PyFuncModel.
|
||||||
|
loaded_model = mlflow.pyfunc.load_model(logged_model)
|
||||||
|
|
||||||
|
with open(f'{loaded_model}/input_example.json') as f:
|
||||||
|
input_example_data = json.load(f)
|
||||||
|
|
||||||
|
# Predictions
|
||||||
|
print(f'input: {input_example_data}')
|
||||||
|
print(f'predictions: {loaded_model.predict(input_example_data)}')
|
Loading…
Reference in New Issue
Block a user