zion581 commited on
Commit
770b4da
1 Parent(s): 037b55f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -115,8 +115,13 @@ class preprocess:
115
  checkpoint3 = ModelCheckpoint("model.hdf5", monitor='val_accuracy', verbose=1, save_best_only=True, mode='auto',
116
  period=1, save_weights_only=False)
117
  history = model.fit(X_train, y_train, epochs=70, validation_data=(X_test, y_test), callbacks=[checkpoint3])
 
 
 
 
118
 
119
  def test(self, text):
 
120
  sentiment = ['Negative', 'Positive']
121
  self.text = text
122
  self.text = purify_data(self.text)
 
115
  checkpoint3 = ModelCheckpoint("model.hdf5", monitor='val_accuracy', verbose=1, save_best_only=True, mode='auto',
116
  period=1, save_weights_only=False)
117
  history = model.fit(X_train, y_train, epochs=70, validation_data=(X_test, y_test), callbacks=[checkpoint3])
118
+
119
+ def choose_model(self):
120
+ best_model = keras.models.load_model("model.hdf5")
121
+ return best_model
122
 
123
  def test(self, text):
124
+ best_model = self.choose_model()
125
  sentiment = ['Negative', 'Positive']
126
  self.text = text
127
  self.text = purify_data(self.text)