From 7baecd43ef757cea5a8692ea5f766ecd458aa919 Mon Sep 17 00:00:00 2001 From: Kamila Date: Sun, 15 May 2022 13:28:18 +0200 Subject: [PATCH] mlflow attempt task 2 prediction registry --- predict_registry.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/predict_registry.py b/predict_registry.py index ffe8bb7..c291fa7 100644 --- a/predict_registry.py +++ b/predict_registry.py @@ -3,24 +3,7 @@ import mlflow import numpy as np import sys -mlflow.set_tracking_uri("http://172.17.0.1:5000") -client =mlflow.tracking .MlflowClient() -model_version = 14 -model_name = "s449288" -experiment = client.get_latest_versions(model_name, stages=None) -print(experiment) -print(experiment[0].source) -model = mlflow.pyfunc.load_model( - model_uri=f"models:/{model_name}/{model_version}" -) - -with open(f'{experiment[0].source}/{(sys.argv[1:])[0]}', 'r') as file: - json_data = json.load(file) - print(f"Prediction: {model.predict(np.array([json_data['inputs']]))}") - - -''' PATH = "mlruns/14/80fe21a0804844088147d15a3cebb3e5/artifacts/lego-model" model = mlflow.pyfunc.load_model(PATH) @@ -28,5 +11,5 @@ model = mlflow.pyfunc.load_model(PATH) with open(f'{PATH}/{(sys.argv[1:])[0]}', 'r') as file: json_data = json.load(file) print(f"Prediction: {model.predict(np.array([json_data['inputs']]))}") -''' + \ No newline at end of file