Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,23 +15,27 @@ import unicodedata as ud
|
|
15 |
from underthesea import word_tokenize
|
16 |
|
17 |
from phoBERT import BERT_predict
|
18 |
-
|
19 |
|
20 |
LSTM_model = tf.keras.models.load_model('lstm_model.tf')
|
21 |
|
22 |
GRU_model = tf.keras.models.load_model('gru_model.tf')
|
23 |
|
24 |
def LSTM_predict(x):
|
25 |
-
|
26 |
pred_proba = LSTM_model.predict([x])[0]
|
27 |
-
|
|
|
|
|
28 |
pred_proba = [round(i,2) for i in pred_proba]
|
29 |
|
30 |
return pred_proba
|
31 |
|
32 |
def GRU_predict(x):
|
33 |
-
|
34 |
pred_proba = GRU_model.predict([x])[0]
|
|
|
|
|
35 |
|
36 |
pred_proba = [round(i,2) for i in pred_proba]
|
37 |
|
|
|
15 |
from underthesea import word_tokenize
|
16 |
|
17 |
from phoBERT import BERT_predict
|
18 |
+
import time
|
19 |
|
20 |
LSTM_model = tf.keras.models.load_model('lstm_model.tf')
|
21 |
|
22 |
GRU_model = tf.keras.models.load_model('gru_model.tf')
|
23 |
|
24 |
def LSTM_predict(x):
|
25 |
+
t1 = time.time()
|
26 |
pred_proba = LSTM_model.predict([x])[0]
|
27 |
+
t2 = time.time()
|
28 |
+
print(f'{t2-t1}s')
|
29 |
+
|
30 |
pred_proba = [round(i,2) for i in pred_proba]
|
31 |
|
32 |
return pred_proba
|
33 |
|
34 |
def GRU_predict(x):
|
35 |
+
t1 = time.time()
|
36 |
pred_proba = GRU_model.predict([x])[0]
|
37 |
+
t2 = time.time()
|
38 |
+
print(f'{t2-t1}s')
|
39 |
|
40 |
pred_proba = [round(i,2) for i in pred_proba]
|
41 |
|