Próba z pliku

This commit is contained in:
Anna Nowak 2021-05-24 01:48:11 +02:00
parent f6a9e8a5c6
commit fbb9ac6a26
2 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
pipeline { pipeline {
agent { agent {
docker { image 'adnovac/ium_s434760:4' } docker { image 'adnovac/ium_s434760:4.1' }
} }
parameters{ parameters{
buildSelector( buildSelector(
@ -20,15 +20,14 @@ pipeline {
steps steps
{ {
copyArtifacts(fingerprintArtifacts: true, projectName: 's434788-training/mlflow', selector: buildParameter('WHICH_BUILD')) copyArtifacts(fingerprintArtifacts: true, projectName: 's434788-training/mlflow', selector: buildParameter('WHICH_BUILD'))
sh "echo ${json_input} >> input.json"
} }
} }
stage('test') stage('test')
{ {
steps steps
{ {
catchError { sh 'python3.8 try_model.py'
sh 'python3.8 try_model.py'
}
} }
} }
stage('archive artifacts') { stage('archive artifacts') {

View File

@ -3,8 +3,13 @@ import pandas as pd
import json import json
model = mlflow.keras.load_model("my_model") model = mlflow.keras.load_model("my_model")
with open('my_model/input_example.json') as json_file: data = None
data = json.load(json_file) try:
with open('input.json') as json_file:
data = json.load(json_file)
except:
with open('my_model/input_example.json') as json_file:
data = json.load(json_file)
with open('result.txt', 'w+', encoding="UTF-8") as f: with open('result.txt', 'w+', encoding="UTF-8") as f:
f.write(str(model.predict([data["inputs"]]))) f.write(str(model.predict([data["inputs"]])))