diff --git a/NodeAPI/index.js b/NodeAPI/index.js index 722ff27abf33908ef0e7925b1b688005e539e292..9e489aac6301782c79ef3fef53d416ba1d1c1cba 100644 --- a/NodeAPI/index.js +++ b/NodeAPI/index.js @@ -3,7 +3,7 @@ const bodyParser = require('body-parser'); const request = require('request'); const app = express() -const port = 3000; +const port = 80; app.set('view engine', 'ejs') diff --git a/build.py b/build.py index 9dadca9b91dbdd2df2ed5487def1f8abcde024b7..1794e1f4fdced1706e0dff0b9b4f6e9218a0a599 100644 --- a/build.py +++ b/build.py @@ -16,14 +16,13 @@ from numpy import array from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split - +from datetime import datetime #Functions for splitting into train/test sets. def split_dataset(df, test_size=0.25): movies_train, movies_test = train_test_split(df, test_size=test_size, shuffle=True) return movies_train, movies_test - def get_train_test(df, test_size=0.25): movies_train, movies_test = split_dataset(df, test_size) @@ -453,19 +452,16 @@ classifier = OneVsRestClassifier(lr_classifier) classifier.fit(x_train_lr, y_train_lr) -with open('vectorizer.pickle', 'wb') as handle: - pickle.dump(vectorizer, handle) - -with open('mlb.pickle', 'wb') as handle: - pickle.dump(mlb, handle) +for item in ['mlb', 'vectorizer','model']: + with open(f'{item}.pickle', 'wb') as handle: + pickle.dump(item, handle) -with open('model.pickle', 'wb') as handle: - pickle.dump(classifier, handle) +#Automatically restart the services: MAY NEED TO CHANGE TO PUSH TO GITHUB AND THEN SSHING INTO THE SERVER ETC ETC -print('Restarting services') -os.chdir("~/Dev/coursework") -os.system("forever restart;cd NodeAPI;pm2 restart /NodeAPI/index.js") -print('Restarted services') +# print('Restarting services') +# os.chdir("~/Dev/coursework") +# os.system("forever restart;cd NodeAPI;pm2 restart /NodeAPI/index.js") +# print('Restarted services')