HMPhuoc commited on
Commit
7163957
1 Parent(s): 113647b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -13,7 +13,7 @@ import keras
13
 
14
  from underthesea import word_tokenize
15
 
16
- from phoBERT import BERT_predict
17
 
18
  #Load tokenizer
19
  # fp = Path(__file__).with_name('tokenizer.pkl')
@@ -21,12 +21,12 @@ from phoBERT import BERT_predict
21
  # tokenizer = pickle.load(f)
22
 
23
  #Load LSTM
24
- # fp = Path(__file__).with_name('lstm_model.keras')
25
- LSTM_model = tf.keras.models.load_model('lstm_model.keras')
26
 
27
  #Load GRU
28
- # fp = Path(__file__).with_name('gru_model.keras')
29
- GRU_model = tf.keras.models.load_model('gru_model.keras')
30
 
31
 
32
  def tokenizer_pad(tokenizer,comment_text,max_length=200):
@@ -82,15 +82,15 @@ def judge(x):
82
 
83
  lstm_pred = LSTM_predict(x)
84
  gru_pred = GRU_predict(x)
85
- bert_pred = BERT_predict(x)
86
  #print(result)
87
 
88
  return_result = 'Result'
89
  result_lstm = np.round(lstm_pred, 2)
90
  result_gru = np.round(gru_pred, 2)
91
- result_bert = np.round(bert_pred, 2)
92
  for i in range(6):
93
- result.append((result_lstm[i]+result_gru[i]+result_bert[i])/3)
94
 
95
  return (result)
96
 
 
13
 
14
  from underthesea import word_tokenize
15
 
16
+ #from phoBERT import BERT_predict
17
 
18
  #Load tokenizer
19
  # fp = Path(__file__).with_name('tokenizer.pkl')
 
21
  # tokenizer = pickle.load(f)
22
 
23
  #Load LSTM
24
+ fp = Path(__file__).with_name('lstm_model.keras')
25
+ LSTM_model = tf.keras.models.load_model(fp)
26
 
27
  #Load GRU
28
+ fp = Path(__file__).with_name('gru_model.keras')
29
+ GRU_model = tf.keras.models.load_model(fp)
30
 
31
 
32
  def tokenizer_pad(tokenizer,comment_text,max_length=200):
 
82
 
83
  lstm_pred = LSTM_predict(x)
84
  gru_pred = GRU_predict(x)
85
+ # bert_pred = BERT_predict(x)
86
  #print(result)
87
 
88
  return_result = 'Result'
89
  result_lstm = np.round(lstm_pred, 2)
90
  result_gru = np.round(gru_pred, 2)
91
+ # result_bert = np.round(bert_pred, 2)
92
  for i in range(6):
93
+ result.append((result_lstm[i]+result_gru[i])/2)
94
 
95
  return (result)
96