NLP Sample App

Colin Carroll

An example of wiring responsive jQuery together with Flask and spaCy to make a simple, ml-powered app. This is a demo used in a lecture for MAS 500 at MIT in the Fall of 2017. The goal was to provide an overview of tools and considerations for using machine learning while building software. My lecture notes, a Jupyter notebook, are available on github

It runs on ~20 lines of Python, and ~20 lines of JavaScript.


Installation

This assumes you are using conda, a Python package manager similar to pip, but focused on numerical computing. It can be downloaded here.

  1. Get the code
                        $ git clone https://github.com/ColCarroll/working_ml.git 
                        $ cd working_ml
                    
  2. Create a virtual environment
                        $ conda create -n working_ml python=3.6
                        $ source activate working_ml
                        $ conda install keras spacy scikit-learn seaborn matplotlib flask jupyter
                        # The nlp library requires extra files
                        $ python -m spacy download en
                    
  3. This command runs the this site:
                        $ FLASK_APP=app.py flask run
                         * Serving Flask app "app"
                         * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
                    
  4. In a new terminal
                        $ cd working_ml
                        $ open index.html
                    
  5. You could also (or instead) run the notebook in a new terminal with
                        $ cd working_ml
                        $ jupyter notebook
                    

References

Basic Tools

Sharing

Numeric Libraries

Machine Learning

Visualization

Natural Language Processing

Deep Learning