ium_430705/lab_09_predict_coop.py

22 lines
568 B
Python
Raw Normal View History

import json
import mlflow
import pandas as pd
model_name = "s430705"
2021-05-27 14:16:22 +02:00
model_version = 30
2021-05-27 13:54:34 +02:00
mlflow.set_tracking_uri("http://172.17.0.1:5000")
model = mlflow.pyfunc.load_model(
model_uri=f"models:/{model_name}/{model_version}"
)
2021-05-27 14:38:58 +02:00
with open('/tmp/mlruns/0/6be4f90846214df8913a553bc53b1019/artifacts/movies_imdb2/input_example.json', 'r') as datafile:
data = json.load(datafile)
example_input = data["inputs"]
2021-05-27 14:38:58 +02:00
input_dictionary = {i: x for i, x in enumerate(example_input)}
input_ex = pd.DataFrame(input_dictionary, index=[0])
print(model.predict(input_ex))