mlflow attempt task 2 prediction

This commit is contained in:
Kamila 2022-05-15 12:55:35 +02:00
parent 771269fc4c
commit 4edda8a804

View File

@ -3,14 +3,13 @@ import mlflow
import numpy as np import numpy as np
import sys import sys
import tarfile import tarfile
import os
file = tarfile.open('mlruns.tar.gz') file = tarfile.open('mlruns.tar.gz')
file.extractall('./ml') file.extractall('./ml')
input = str((sys.argv[1:])[0]) input = str((sys.argv[1:])[0])
PATH = "ml/mlruns/1/f65f936936024133a2c03e1e486ba9cf/artifacts/model/" PATH = "ml/mlruns/1/f65f936936024133a2c03e1e486ba9cf/artifacts/model/"
print(os.listdir(PATH)) model =mlflow.pyfunc.load_model(f"{PATH}/MLmodel")
model = mlflow.pytorch.load_model(f"{PATH}/MLmodel")
with open(f'[PATH]/{input}', 'r') as file: with open(f'[PATH]/{input}', 'r') as file:
json_data = json.load(file) json_data = json.load(file)