HMPhuoc commited on
Commit
c221482
1 Parent(s): 6ea5605

change models keras

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -16,16 +16,16 @@ from underthesea import word_tokenize
16
  from phoBERT import BERT_predict
17
 
18
  #Load tokenizer
19
- fp = Path(__file__).with_name('tokenizer.pkl')
20
- with open(fp,mode="rb") as f:
21
- tokenizer = pickle.load(f)
22
 
23
  #Load LSTM
24
- fp = Path(__file__).with_name('lstm_model.h5')
25
  LSTM_model = load_model(fp)
26
 
27
  #Load GRU
28
- fp = Path(__file__).with_name('gru_model.h5')
29
  GRU_model = load_model(fp)
30
 
31
 
@@ -40,7 +40,7 @@ def tokenizer_pad(tokenizer,comment_text,max_length=200):
40
  return padded_sequences
41
 
42
  def LSTM_predict(x):
43
- x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
44
 
45
  pred_proba = LSTM_model.predict(x)[0]
46
 
@@ -51,7 +51,7 @@ def LSTM_predict(x):
51
  return pred_proba
52
 
53
  def GRU_predict(x):
54
- x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
55
 
56
 
57
  pred_proba = GRU_model.predict(x)[0]
 
16
  from phoBERT import BERT_predict
17
 
18
  #Load tokenizer
19
+ # fp = Path(__file__).with_name('tokenizer.pkl')
20
+ # with open(fp,mode="rb") as f:
21
+ # tokenizer = pickle.load(f)
22
 
23
  #Load LSTM
24
+ fp = Path(__file__).with_name('lstm_model.keras')
25
  LSTM_model = load_model(fp)
26
 
27
  #Load GRU
28
+ fp = Path(__file__).with_name('gru_model.keras')
29
  GRU_model = load_model(fp)
30
 
31
 
 
40
  return padded_sequences
41
 
42
  def LSTM_predict(x):
43
+ #x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
44
 
45
  pred_proba = LSTM_model.predict(x)[0]
46
 
 
51
  return pred_proba
52
 
53
  def GRU_predict(x):
54
+ #x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
55
 
56
 
57
  pred_proba = GRU_model.predict(x)[0]