Enabling Multifile Upload

Thoughts and actions on making our platform more usable

The problem


Our current prototype being developed allowed only for single file uploads where the file and predict function within the file had to be named 'model.py' and 'predict' respectively. I soon realised that this was something we needed change for usability’s sake. If we wanted to build a project which was useful and catered to the industry standard classifier models, they were more likely to be multiple files and named various things, some might not even be in English! I had two problems, enable multifile uploads and import the predict function from the folder uploaded, regardless of where it was.


The inspiration and solution


Upon discovering this problem, Laasya, who has experience with hosting and maintaining projects on Heroku proposed a 'Procfile' styled approach. The Heroku 'Procfile' is a mandatory file users must add when wanting to host and deploy their projects on Heroku. The procfile follows a certain format and species commands to start the app. We implemented our own 'Procfile' naming it the config file. In this json file, the user can specify the module, class, and function of the final predict function. The backend then takes these configurations along with requirements.txt, pickle of the model and zip of the source code. These are then loaded on to a temporary directory, docker file and api. Finally, the loaded code can support calls to the trained model. (Additionally, the image is saved as a as a .tar in ./data/models.)