update jenkinsfile_predict, predict.py
This commit is contained in:
parent
245aa17202
commit
035b4245e6
@ -16,7 +16,7 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage('Script') {
|
stage('Script') {
|
||||||
steps {
|
steps {
|
||||||
copyArtifacts projectName: 's444409-training/main', selector: lastSuccessful()
|
copyArtifacts projectName: 's444356-training/main', selector: lastSuccessful()
|
||||||
sh 'python3 ./predict.py $INPUT'
|
sh 'python3 ./predict.py $INPUT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
predict.py
25
predict.py
@ -1,14 +1,29 @@
|
|||||||
|
#import json
|
||||||
|
#import mlflow
|
||||||
|
#import sys
|
||||||
|
|
||||||
|
#input = sys.argv[1]
|
||||||
|
|
||||||
|
#logged_model = 'mlruns/1/3630068c31924c05a9a04e70ef35e0b8/artifacts/s444409'
|
||||||
|
#loaded_model = mlflow.pyfunc.load_model(logged_model)
|
||||||
|
|
||||||
|
|
||||||
|
#with open(f'{logged_model}/'+input) as f:
|
||||||
|
# data = json.load(f)
|
||||||
|
|
||||||
|
#loaded_model.predict(data['inputs'])
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import mlflow
|
import mlflow
|
||||||
import sys
|
import numpy as np
|
||||||
|
|
||||||
input = sys.argv[1]
|
logged_model = 'mlruns/1/296d6f314bb2451885fb7ae58988301e/artifacts/model'
|
||||||
|
|
||||||
logged_model = 'mlruns/1/3630068c31924c05a9a04e70ef35e0b8/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(f'{logged_model}/'+input) as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
input_example = np.array([data['inputs'][0]], dtype=np.float64).reshape(-1, 2)
|
||||||
|
|
||||||
loaded_model.predict(data['inputs'])
|
|
||||||
|
print(f'Prediction: {loaded_model.predict(input_example)}')
|
Loading…
Reference in New Issue
Block a user