Simple sklearn data prep & LinearSVC model training and deployment with Flask
Example training data is downloaded in a datasets folder via the Kaggle API (make sure to install the kaggle package and store your API token in the .json folder; if unsure read the Kaggle API docs)
Following training, the model & its metadata is stored in the models folder using joblib. The model in this case contains also the data preprocessing pipeline implementing tf-idf text vectorization - i.e., When calling .predict() just pass the raw text.
Test the api by running requests.py (in a new terminal) after running the Flask app server.
To edit/add requests, simply edit the "input" field in the api_test_data.json file. It is possible to ask the api for both 0/1 or negative/positive class labels when making predictions by editing the "class labels" filed of the request (set to "True" for labels).