Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,18 +36,11 @@ def tokenizer_pad(tokenizer,comment_text,max_length=200):
|
|
| 36 |
def LSTM_predict(x):
|
| 37 |
x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
|
| 38 |
|
| 39 |
-
|
| 40 |
-
#print(x)
|
| 41 |
-
|
| 42 |
-
# processing before mapping
|
| 43 |
-
|
| 44 |
-
# predicting using best model
|
| 45 |
pred_proba = LSTM_model.predict(x)[0]
|
| 46 |
|
| 47 |
-
# making predictions readable
|
| 48 |
pred_proba = [round(i,2) for i in pred_proba]
|
| 49 |
|
| 50 |
-
print(pred_proba)
|
| 51 |
|
| 52 |
return pred_proba
|
| 53 |
|
|
@@ -56,15 +49,12 @@ def GRU_predict(x):
|
|
| 56 |
|
| 57 |
|
| 58 |
print(x)
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
# predicting using best model
|
| 62 |
pred_proba = GRU_model.predict(x)[0]
|
| 63 |
|
| 64 |
-
# making predictions readable
|
| 65 |
pred_proba = [round(i,2) for i in pred_proba]
|
| 66 |
|
| 67 |
-
print(pred_proba)
|
| 68 |
|
| 69 |
return pred_proba
|
| 70 |
|
|
@@ -82,7 +72,8 @@ def judge(x):
|
|
| 82 |
result_lstm = np.round(lstm_pred, 2)
|
| 83 |
result_gru = np.round(gru_pred, 2)
|
| 84 |
sensitive_result = max(max(result_lstm),max(result_gru))
|
| 85 |
-
|
|
|
|
| 86 |
return_result += '\nM么 h矛nh LSTM\n'
|
| 87 |
return_result += f"{result_lstm}\n"
|
| 88 |
for i in range(6):
|
|
|
|
| 36 |
def LSTM_predict(x):
|
| 37 |
x = tokenizer_pad(tokenizer=tokenizer,comment_text=x)
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
pred_proba = LSTM_model.predict(x)[0]
|
| 40 |
|
|
|
|
| 41 |
pred_proba = [round(i,2) for i in pred_proba]
|
| 42 |
|
| 43 |
+
#print(pred_proba)
|
| 44 |
|
| 45 |
return pred_proba
|
| 46 |
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
print(x)
|
| 52 |
+
|
|
|
|
|
|
|
| 53 |
pred_proba = GRU_model.predict(x)[0]
|
| 54 |
|
|
|
|
| 55 |
pred_proba = [round(i,2) for i in pred_proba]
|
| 56 |
|
| 57 |
+
#print(pred_proba)
|
| 58 |
|
| 59 |
return pred_proba
|
| 60 |
|
|
|
|
| 72 |
result_lstm = np.round(lstm_pred, 2)
|
| 73 |
result_gru = np.round(gru_pred, 2)
|
| 74 |
sensitive_result = max(max(result_lstm),max(result_gru))
|
| 75 |
+
|
| 76 |
+
#print(sensitive_result)
|
| 77 |
return_result += '\nM么 h矛nh LSTM\n'
|
| 78 |
return_result += f"{result_lstm}\n"
|
| 79 |
for i in range(6):
|