update jenkinsfile_predict, predict.py
Some checks are pending
s444356-training/pipeline/head Build queued...
s444356-evaluation/pipeline/head This commit looks good

This commit is contained in:
Maciej Czajka 2022-05-11 21:16:05 +02:00
parent 0da61e1b99
commit 540be748a5
2 changed files with 4 additions and 3 deletions

View File

@ -10,8 +10,8 @@ buildSelector(
description: 'Which build to use for copying artifacts for predict', description: 'Which build to use for copying artifacts for predict',
name: 'BUILD_SELECTOR') name: 'BUILD_SELECTOR')
string( string(
defaultValue: 'input_example.json', defaultValue: '{"inputs": [1000.0]}',
description: 'Input file name', description: 'Input file',
name: 'INPUT', name: 'INPUT',
trim: false trim: false
) )
@ -21,6 +21,7 @@ buildSelector(
stage('Script') { stage('Script') {
steps { steps {
copyArtifacts projectName: 's444409-training/main', selector: buildParameter('BUILD_SELECTOR') copyArtifacts projectName: 's444409-training/main', selector: buildParameter('BUILD_SELECTOR')
sh 'echo ${params.INPUT} > input_example.json'
sh 'python3 ./predict.py $INPUT' sh 'python3 ./predict.py $INPUT'
} }
} }

View File

@ -9,7 +9,7 @@ logged_model = 'mlruns/1/70439eb482b54d56b54b0ecc6f1ca96f/artifacts/s444409'
loaded_model = mlflow.pyfunc.load_model(logged_model) loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/'+input) 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.float32) input_example = np.array([data['inputs'][0]], dtype=np.float32)