update dockerfile, add 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 18:51:12 +02:00
parent a6e7769e8d
commit 3e9f82b3ea
3 changed files with 33 additions and 0 deletions

View File

@ -37,6 +37,7 @@ COPY Biblioteka_DL/dllib.py .
COPY Biblioteka_DL/dllib-sacred.py .
COPY Biblioteka_DL/evaluate.py .
COPY Biblioteka_DL/dllib-mlflow.py .
COPY predict.py .
COPY Biblioteka_DL/all_games.csv .
RUN ./download.sh $CUTOFF

16
Jenkinsfile_predict Normal file
View File

@ -0,0 +1,16 @@
pipeline {
agent {
dockerfile {
additionalBuildArgs "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} --build-arg CUTOFF=${params.CUTOFF} -t maciejczajka"
}
}
stages {
stage('Script') {
steps {
copyArtifacts filter: '*', projectName: 's444409-training/master', selector: lastSuccessful()
sh "python predict.py"
}
}
}
}

16
predict.py Normal file
View File

@ -0,0 +1,16 @@
import json
import mlflow
import pandas as pd
#logged_model = 'mlruns/1/d5b6f9c1784a4d2dbb8592cd4ad364d7/artifacts/model'
logged_model = 'mlruns/1/fa3e620f03e64d888c364827907fb6f5/artifacts/s444409'
loaded_model = mlflow.pyfunc.load_model(logged_model)
with open(f'{logged_model}/input_example.json') as f:
data = json.load(f)
input_example = pd.DataFrame(data['inputs'][0])
loaded_model.predict(input_example)