update jenkinsfile_predict, predict.py
This commit is contained in:
parent
0da61e1b99
commit
540be748a5
@ -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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user