update predict.py, jenkinsfile_predict
All checks were successful
s444356-evaluation/pipeline/head This commit looks good
s444356-training/pipeline/head This commit looks good

This commit is contained in:
Maciej Czajka 2022-05-11 20:05:49 +02:00
parent acaf964f41
commit e7cb37ad58
2 changed files with 5 additions and 22 deletions

View File

@ -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'
}
}

View File

@ -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'])