:<
This commit is contained in:
parent
c7bba29b1a
commit
ced9c9dc25
@ -10,4 +10,5 @@ COPY ["Zadanie 1.py", "."]
|
|||||||
COPY ["stats.py", "."]
|
COPY ["stats.py", "."]
|
||||||
COPY ["train.py", "."]
|
COPY ["train.py", "."]
|
||||||
COPY ["evaluate.py", "."]
|
COPY ["evaluate.py", "."]
|
||||||
COPY ["MLProject", "."]
|
COPY ["MLProject", "."]
|
||||||
|
COPY ["try_model.py", "."]
|
||||||
|
40
Jenkinsfile-trymodel
Normal file
40
Jenkinsfile-trymodel
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker { image 'adnovac/ium_s434760:4' }
|
||||||
|
}
|
||||||
|
parameters{
|
||||||
|
buildSelector(
|
||||||
|
defaultSelector: lastSuccessful(),
|
||||||
|
description: 'Which build to use for copying artifacts',
|
||||||
|
name: 'WHICH_BUILD'
|
||||||
|
)
|
||||||
|
string(
|
||||||
|
defaultValue: '',
|
||||||
|
description: 'json input',
|
||||||
|
name: 'json_input'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('copy artifacts')
|
||||||
|
{
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
copyArtifacts(fingerprintArtifacts: true, projectName: 's434788-training', selector: buildParameter('WHICH_BUILD'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('test')
|
||||||
|
{
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
catchError {
|
||||||
|
sh 'python3.8 try_model.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('archive artifacts') {
|
||||||
|
steps {
|
||||||
|
archiveArtifacts 'result.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
try_model.py
Normal file
10
try_model.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import mlflow
|
||||||
|
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)
|
||||||
|
|
||||||
|
with open('result.txt', 'w+', encoding="UTF-8") as f:
|
||||||
|
f.write(str(model.predict([data["inputs"]])))
|
Loading…
Reference in New Issue
Block a user