My scrapbook about anything which I learned or want to remember, Sometime about tech tips, thoughts and rambling. If you find anything useful don't forget to give thumbs-up :)

Breaking

Tuesday, March 27, 2018

ML-DL model as a Service - MLaaS



It is not always the case when we have to give or share the ML/DL model or algorithm with Client, sometime we want to allow users to use our model but without sharing the code or without setting up the infrastructure at Client end.

There is a way to achieve this, Convert your model as a Service, Yes, You can do that. You can expose your model as a Rest Service and user can use the method supported by your Service program. Today, we are going to learn the same.
Let's see how -



Tools Required - 
Flask - A python web server
and of course Python :-)


ML/DL Model Creation: 
For this part, I am picking very basic ML problem - IRIS dataset Classification.
Below code will create a Logistic Regression Classification Model and Save the model as a file.
==

Flask Web Server - REST Service
In below code, we are creating a REST service hosted on local system and having endpoint as "\iris" and Posting the array input to predict the IRIS species
==

How to run Flask Server:
    


Call ML Service:  From Command Line:


Call ML Service:  From Postman Client:









Like the below page to get update  
Facebook Page      Facebook Group      Twitter Feed      Google+ Feed      Telegram Group     


Disclaimer

The postings on this site are my own and don't necessarily represent IBM's or other companies positions, strategies or opinions. All content provided on this blog is for informational purposes and knowledge sharing only.
The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of his information.