Skip to content

palpen/toxic_comment_classifier_web_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toxic Comment Classification Web App

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).

Data used for training

Kaggle Toxic Comment Classification Challenge

How to run locally

export FLASK_APP=hello.py
export FLASK_DEBUG=1
python ml_app.py

Very useful references

Deployment related notes

  1. App is deployed on pythonanywhere.com
  2. 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.
  3. The app needs sklearn, numpy, and scipy (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.
  4. the -w 2 option in Procfile limits the number of workers to 2 to minimize memory accumulation due to leak (each dyno only has 512mb of ram)

To do:

  • [] 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

About

Flask-based web application for classifying toxic comments

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages