achmaddhani commited on
Commit
10e5f20
·
1 Parent(s): f7d313c

Update functions.py

Browse files
Files changed (1) hide show
  1. functions.py +10 -9
functions.py CHANGED
@@ -40,12 +40,13 @@ def text_model(df):
40
  return df['preprocessed_text']
41
 
42
  def prediction(model, X):
43
- y_pred = model.predict(X)
44
- predictions = np.argmax(y_pred, axis=1)
45
- for index, val in enumerate(predictions):
46
- if val == 0:
47
- return f"Text {index} indicates the person is feeling FEAR"
48
- elif val == 1:
49
- return f"Text {index} indicates the person is feeling ANGER"
50
- else:
51
- return f"Text {index} indicates the person is feeling JOY"
 
 
40
  return df['preprocessed_text']
41
 
42
  def prediction(model, X):
43
+ model = load_model('best_model.keras')
44
+ y_pred = model.predict(X)
45
+ predictions = np.argmax(y_pred, axis=1)
46
+ for index, val in enumerate(predictions):
47
+ if val == 0:
48
+ return f"Text {index} indicates the person is feeling FEAR"
49
+ elif val == 1:
50
+ return f"Text {index} indicates the person is feeling ANGER"
51
+ else:
52
+ return f"Text {index} indicates the person is feeling JOY"