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)