import flask
import pickle
import pickle
import sklearn
import pandas as pd

# app is a single object used by all the code modules in this package
app = flask.Flask(__name__)  # pylint: disable=invalid-name

lr_model = pickle.load(open('RNNVis/static/model/model.pkl', 'rb'))
lr_vectorizer = pickle.load(open('RNNVis/static/model/vectorizer.pkl', 'rb'))
dataset = pd.read_csv('RNNVis/static/model/cleaned.csv')
s_model = pickle.load(open('RNNVis/static/sentiment_model/model.pkl', 'rb'))
s_vectorizer = pickle.load(open('RNNVis/static/sentiment_model/vectorizer.pkl', 'rb'))
s_dataset = pd.read_csv('RNNVis/static/sentiment_model/cleaned_sentiment.csv')
# Read settings from config module (produck/config.py)
app.config.from_object('RNNVis.config')

# Overlay settings read from file specified by environment variable. This is
# useful for using different on development and production machines.
# Reference: http://flask.pocoo.org/docs/config/
app.config.from_envvar('RNNVIS_SETTINGS', silent=True)

# Tell our app about views and model.  This is dangerously close to a
# circular import, which is naughty, but Flask was designed that way.
# (Reference http://flask.pocoo.org/docs/patterns/packages/)  We're
# going to tell pylint and pycodestyle to ignore this coding style violation.
import RNNVis.views  # noqa: E402  pylint: disable=wrong-import-position
