I have locally trained a sklearn classifier and I have to create a simple web application that demonstrate its use. I’m a complete noob on web app development and I don’t want to waste hours on creating a web app using a framework that doesn’t support the modules I’m using.
- What do you suggest would be a good approach for this task?
- What web app development framework should I use (if any)?
- Do I have to dive into things like
Heroku,djangoetc. or is there more simple and quicker solutions for a simple scientific demo?
My thought was to take the classifier I trained, pickle it and un-pickle it on the server, then to run classify from the server, but I’m not sure where to begin.
If this is just for a demo, train your classifier offline, pickle the model and then use a simple python web framework such as flask or bottle to unpickle the model at server startup time and call the predict function in an HTTP request handler.
django is a feature complete framework hence is longer to learn than flask or bottle but it has a great documentation and a larger community.
heroku is a service to host your application in the cloud. It’s possible to host flask applications on heroku, here is a simple template project + instructions to do so.
For “production” setups I would advise you not to use pickle but to write your own persistence layer for the machine learning model so as to have full control on the parameters your store and be more robust to library upgrades that might break the unpickling of old models.