Add input param

This commit is contained in:
Marcin Kostrzewski 2022-05-11 20:55:34 +02:00
parent cfab6beb44
commit 24d2eb83cb
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,12 @@ pipeline {
} }
} }
parameters { parameters {
string(
defaultValue: '{"inputs": [[0.51, 0.86], [0.79, 0.79], [0.74, 0.77], [0.66, 0.73]]}',
description: 'Input',
name: 'INPUT',
trim: true
)
buildSelector( buildSelector(
defaultSelector: lastSuccessful(), defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts', description: 'Which build to use for copying artifacts',
@ -20,6 +26,7 @@ pipeline {
} }
stage('Predict values using model from artifact') { stage('Predict values using model from artifact') {
steps { steps {
sh "echo ${params.INPUT} > input_example.json"
sh "python predict_s444356.py" sh "python predict_s444356.py"
} }
} }

View File

@ -6,7 +6,7 @@ logged_model = 'mlruns/1/296d6f314bb2451885fb7ae58988301e/artifacts/model'
loaded_model = mlflow.pyfunc.load_model(logged_model) loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/input_example.json') as f: with open('input_example.json') as f:
data = json.load(f) data = json.load(f)
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2) input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)