From 50aa089bc3c92e4a49ca28e88372cd071a0757d4 Mon Sep 17 00:00:00 2001 From: "Mcintosh, Liam S (UG - Computer Science)" <lm00840@surrey.ac.uk> Date: Mon, 24 May 2021 13:14:13 +0000 Subject: [PATCH] Pickle files individually --- build.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index 3e7c174..728e346 100644 --- a/build.py +++ b/build.py @@ -457,10 +457,14 @@ classifier.fit(x_train_lr, y_train_lr) print("Pickling files...") -for item in ['mlb', 'vectorizer','model']: - print("Saving " + f'{item}.pickle') - with open(f'{item}.pickle', 'wb') as handle: - pickle.dump(item, handle) +with open('vectorizer.pickle', 'wb') as handle: + pickle.dump(vectorizer, handle) + +with open('mlb.pickle', 'wb') as handle: + pickle.dump(mlb, handle) + +with open('model.pickle', 'wb') as handle: + pickle.dump(model, handle) #Automatically restart the services: MAY NEED TO CHANGE TO PUSH TO GITHUB AND THEN SSHING INTO THE SERVER ETC ETC -- GitLab