copy model from mlflow script

This commit is contained in:
Dawid 2021-05-23 18:50:55 +02:00
parent 77d67c220c
commit 3e34456d79

18
pred_from_mlflow_model.py Normal file
View File

@ -0,0 +1,18 @@
import mlflow as mlf
import json
import mlflow as mlf
import pandas as pd
model_name = "movies_imdb"
model_version = 1
model = mlf.pyfunc.load_model(
model_uri=f"models:/{model_name}/{model_version}"
)
with open('movies_imdb/input_example.json', 'r') as datafile:
data = json.load(datafile)['inputs']
input_dictionary = {idx:x for idx, x in enumerate(data)}
input_ex = pd.DataFrame([input_dictionary])
print(model.predict(input_ex))