Make into Flask app

Can be run as Flask app or from command line now.