Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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)
|