HMPhuoc commited on
Commit
9d6299e
1 Parent(s): 51cc186

remove bert from prediction

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. phoBERT.py +9 -2
app.py CHANGED
@@ -14,7 +14,7 @@ import unicodedata as ud
14
 
15
  from underthesea import word_tokenize
16
 
17
- from phoBERT import BERT_predict
18
 
19
  # Load tokenizer
20
  # fp = Path(__file__).with_name('tokenizer.pkl')
@@ -86,14 +86,14 @@ def judge(x):
86
 
87
  lstm_pred = LSTM_predict(x)
88
  gru_pred = GRU_predict(x)
89
- bert_pred = BERT_predict(x)
90
  #print(result)
91
 
92
  return_result = 'Result'
93
  result_lstm = np.round(lstm_pred, 2)
94
  result_gru = np.round(gru_pred, 2)
95
- result_bert = np.round(bert_pred, 2)
96
  for i in range(6):
97
- result.append((result_lstm[i]+result_gru[i]+result_bert[i])/3)
98
 
99
  return (result)
 
14
 
15
  from underthesea import word_tokenize
16
 
17
+ #from phoBERT import BERT_predict
18
 
19
  # Load tokenizer
20
  # fp = Path(__file__).with_name('tokenizer.pkl')
 
86
 
87
  lstm_pred = LSTM_predict(x)
88
  gru_pred = GRU_predict(x)
89
+ #bert_pred = BERT_predict(x)
90
  #print(result)
91
 
92
  return_result = 'Result'
93
  result_lstm = np.round(lstm_pred, 2)
94
  result_gru = np.round(gru_pred, 2)
95
+ #result_bert = np.round(bert_pred, 2)
96
  for i in range(6):
97
+ result.append((result_lstm[i]+result_gru[i])/2)
98
 
99
  return (result)
phoBERT.py CHANGED
@@ -78,7 +78,14 @@ def BERT_predict(text):
78
  token_type_ids = token['token_type_ids']
79
 
80
  result = model(ids, mask, token_type_ids)
81
- print(result)
82
  return result.tolist()[0]
83
 
84
- print(BERT_predict("xin chaof"))
 
 
 
 
 
 
 
 
78
  token_type_ids = token['token_type_ids']
79
 
80
  result = model(ids, mask, token_type_ids)
81
+ # print(result)
82
  return result.tolist()[0]
83
 
84
+ print(BERT_predict("xin chaof"))
85
+ print(BERT_predict("con chó"))
86
+ print(BERT_predict("đồ chó"))
87
+ print(BERT_predict("đồ ngu"))
88
+ print(BERT_predict("cái lồn"))
89
+ print(BERT_predict("óc chó"))
90
+ print(BERT_predict("đồ chó đẻ"))
91
+ print(BERT_predict("con đĩ"))