I have an existing machine learning model saved on my local system. I want to deploy this model as a web service so I can consume this model as a request-response i.e. send an HTTP request to the model and get back a predicted response.
When attempting to deploy this model on AzureML I run into a few problems
The model needs to be initialized in an entry script int the init() function, but for initializing my model I have a custom class and require few txt files to be loaded.
below is the code to initialize the model object
from model_file import MyModelClass # this is the file which contains the model class
def init():
global robert_model
my_model = MyModelClass(vocab_path='<path-to-text-files>',
model_paths=['<path-to-model-file>'],
iterations=5,
min_error_probability=0.0,
min_probability=0.0,
weigths=None)
def run(json_data):
try:
data = json.loads(json_data)
preds, cnt = my_model.handle_batch([sentence.split()])
return {'output': pred, 'count': cnt}
except Exception as e:
error = str(e)
return error
I don't know how to import those class files and text files in the entry script
I don't know much about azure, and I am having a hard time figuring this out. Please help.
