From 540be748a5c88a682f016045385e0a82ad2237c4 Mon Sep 17 00:00:00 2001 From: Maciej Czajka Date: Wed, 11 May 2022 21:16:05 +0200 Subject: [PATCH] update jenkinsfile_predict, predict.py --- Jenkinsfile_predict | 5 +++-- predict.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_predict b/Jenkinsfile_predict index 7574b8a..91d5538 100644 --- a/Jenkinsfile_predict +++ b/Jenkinsfile_predict @@ -10,8 +10,8 @@ buildSelector( description: 'Which build to use for copying artifacts for predict', name: 'BUILD_SELECTOR') string( - defaultValue: 'input_example.json', - description: 'Input file name', + defaultValue: '{"inputs": [1000.0]}', + description: 'Input file', name: 'INPUT', trim: false ) @@ -21,6 +21,7 @@ buildSelector( stage('Script') { steps { copyArtifacts projectName: 's444409-training/main', selector: buildParameter('BUILD_SELECTOR') + sh 'echo ${params.INPUT} > input_example.json' sh 'python3 ./predict.py $INPUT' } } diff --git a/predict.py b/predict.py index a64f8b8..093cf89 100644 --- a/predict.py +++ b/predict.py @@ -9,7 +9,7 @@ logged_model = 'mlruns/1/70439eb482b54d56b54b0ecc6f1ca96f/artifacts/s444409' 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) input_example = np.array([data['inputs'][0]], dtype=np.float32)