From 82d47c078feef2dd92967f292cb470cf129b2b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zar=C4=99ba?= Date: Thu, 27 May 2021 13:51:19 +0200 Subject: [PATCH] Dodanie 'lab_09_predict_coop.py' Add test prediction from registry --- lab_09_predict_coop.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lab_09_predict_coop.py diff --git a/lab_09_predict_coop.py b/lab_09_predict_coop.py new file mode 100644 index 0000000..e47ecbe --- /dev/null +++ b/lab_09_predict_coop.py @@ -0,0 +1,21 @@ +import json +import mlflow +import pandas as pd + + +model_name = "s430705" +model_version = 8 + +mlflow.set_tracking_uri("http://172.17.0.1:5000") + +model = mlflow.pyfunc.load_model( + model_uri=f"models:/{model_name}/{model_version}" +) + +with open('movies_imdb2/input_example.json', 'r') as datafile: + data = json.load(datafile) + example_input = data["inputs"] + +input_dictionary = {i: x for i, x in enumerate(example_input)} +input_ex = pd.DataFrame(input_dictionary, index=[0]) +print(model.predict(input_ex))