Flask-based web application for a machine learning model that classifies toxic comments.
You can test it here (http://pspenano.pythonanywhere.com)
I use a modified implementation of the NBSVM algorithm (using logistic regression instead of SVM) to train on a corpus of comments from Wikipedia edits (see below for data source). The model is from this paper and the implementation of the algorithm is by Jeremy Howard (found here).
Kaggle Toxic Comment Classification Challenge
export FLASK_APP=hello.py
export FLASK_DEBUG=1
python ml_app.py
- Deploying a Flask app on Heroku
- Building a simple Keras deep learning REST API
- Flask API for scikit-learn
- App is deployed on pythonanywhere.com
- Heroku has a hard limit of 512mb RAM for both the free and hobby tiers. This app consumes roughly 500mb per worker, which is not ideal. Pythonanywhere offers significantly more ram at 3gb. Also, the hobby tier allows you to add more storage at 25 cents per gb.
- The app needs
sklearn,numpy, andscipy(see requirements.txt) to be able to load the trained models. When I installed the requirements, I hit the 512mb storage limit in the free tier immediately, which means you need at minimum roughly 1gb of storage. - the
-w 2option inProcfilelimits the number of workers to 2 to minimize memory accumulation due to leak (each dyno only has 512mb of ram)
- [] Fix view function names
- [] Add page explaining details of algorithm
- [] Add database to backend to save submitted comments
- [] Implement deep learning based approach for better performance
- Create environment file with versions, test all code, redo heroku
- Deploy
- Refactor code used for training model and add to repository
- Implement view functions that classifies input comment