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

View File

@ -3,8 +3,13 @@ import pandas as pd
import json
model = mlflow.keras.load_model("my_model")
with open('my_model/input_example.json') as json_file:
data = json.load(json_file)
data = None
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:
f.write(str(model.predict([data["inputs"]])))