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