17 lines
459 B
Python
17 lines
459 B
Python
|
import json
|
||
|
import mlflow
|
||
|
import numpy as np
|
||
|
import torch
|
||
|
from torch.autograd import Variable
|
||
|
|
||
|
logged_model = 'mlruns/1/d5b6f9c1784a4d2dbb8592cd4ad364d7/artifacts/model'
|
||
|
loaded_model = mlflow.pyfunc.load_model(logged_model)
|
||
|
|
||
|
|
||
|
with open(f'{logged_model}/input_example.json') as f:
|
||
|
data = json.load(f)
|
||
|
input_example = np.array(data['inputs'][0])
|
||
|
input_example = Variable(torch.from_numpy(input_example)).float()
|
||
|
|
||
|
loaded_model.predict(input_example)
|