Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -92,15 +92,13 @@ def process_api(text):
|
|
92 |
SVM_Predicted = SVM_model.predict(processed_text).tolist() # SVC Model
|
93 |
Seq_Predicted = Seq_model.predict(padded_sequence)
|
94 |
predicted_label_index = np.argmax(Seq_Predicted)
|
95 |
-
print(int(predicted_label_index))
|
96 |
|
97 |
# ----------- Proba -----------
|
98 |
Logistic_Predicted_proba = logistic_model.predict_proba(processed_text)
|
99 |
-
#print(float(np.max(Logistic_Predicted_proba)))
|
100 |
svm_new_probs = SVM_model.decision_function(processed_text)
|
101 |
svm_probs = svm_model.predict_proba(svm_new_probs)
|
102 |
-
|
103 |
-
|
104 |
# ----------- Debug Logs -----------
|
105 |
logistic_debug = decodedLabel(int(Logistic_Predicted[0]))
|
106 |
svc_debug = decodedLabel(int(SVM_Predicted[0]))
|
@@ -114,7 +112,10 @@ def process_api(text):
|
|
114 |
|
115 |
'predicted_label_svm': decodedLabel(int(SVM_Predicted[0])),
|
116 |
'probability_svm': f"{int(float(np.max(svm_probs))*10000//100)}%",
|
117 |
-
|
|
|
|
|
|
|
118 |
'Article_Content': text
|
119 |
}
|
120 |
|
@@ -229,7 +230,10 @@ if url:
|
|
229 |
"predicted_label": result.get("predicted_label_svm"),
|
230 |
"probability": result.get("probability_svm")
|
231 |
},
|
232 |
-
"LSTM":
|
|
|
|
|
|
|
233 |
})
|
234 |
|
235 |
st.divider() # π Draws a horizontal rule
|
|
|
92 |
SVM_Predicted = SVM_model.predict(processed_text).tolist() # SVC Model
|
93 |
Seq_Predicted = Seq_model.predict(padded_sequence)
|
94 |
predicted_label_index = np.argmax(Seq_Predicted)
|
|
|
95 |
|
96 |
# ----------- Proba -----------
|
97 |
Logistic_Predicted_proba = logistic_model.predict_proba(processed_text)
|
|
|
98 |
svm_new_probs = SVM_model.decision_function(processed_text)
|
99 |
svm_probs = svm_model.predict_proba(svm_new_probs)
|
100 |
+
|
101 |
+
predicted_label_index = np.argmax(Seq_Predicted)
|
102 |
# ----------- Debug Logs -----------
|
103 |
logistic_debug = decodedLabel(int(Logistic_Predicted[0]))
|
104 |
svc_debug = decodedLabel(int(SVM_Predicted[0]))
|
|
|
112 |
|
113 |
'predicted_label_svm': decodedLabel(int(SVM_Predicted[0])),
|
114 |
'probability_svm': f"{int(float(np.max(svm_probs))*10000//100)}%",
|
115 |
+
|
116 |
+
'predicted_label_lstm': decodedLabel(int(predicted_label_index)),
|
117 |
+
'probability_lstm': f"{int(float(np.max(Seq_Predicted))*10000//100)}%",
|
118 |
+
|
119 |
'Article_Content': text
|
120 |
}
|
121 |
|
|
|
230 |
"predicted_label": result.get("predicted_label_svm"),
|
231 |
"probability": result.get("probability_svm")
|
232 |
},
|
233 |
+
"LSTM": {
|
234 |
+
"predicted_label": result.get("predicted_label_lstm"),
|
235 |
+
"probability": result.get("probability_lstmlstm")
|
236 |
+
}
|
237 |
})
|
238 |
|
239 |
st.divider() # π Draws a horizontal rule
|