hackerbyhobby
commited on
changes
Browse files
app.py
CHANGED
@@ -12,6 +12,16 @@ import os
|
|
12 |
import numpy as np
|
13 |
from shap.maskers import Text
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Translator instance
|
16 |
translator = GoogleTranslator(source="auto", target="es")
|
17 |
|
@@ -228,7 +238,7 @@ This tool classifies messages as SMiShing, Other Scam, or Legitimate using a zer
|
|
228 |
(joeddav/xlm-roberta-large-xnli). It automatically detects if the text is Spanish or English.
|
229 |
It uses SHAP for explainability and checks URLs against Google's Safe Browsing API for enhanced analysis.
|
230 |
""",
|
231 |
-
flagging_mode="
|
232 |
)
|
233 |
|
234 |
if __name__ == "__main__":
|
|
|
12 |
import numpy as np
|
13 |
from shap.maskers import Text
|
14 |
|
15 |
+
# Patch SHAP to replace np.bool with np.bool_ dynamically
|
16 |
+
if hasattr(shap.maskers._text.Text, "invariants"):
|
17 |
+
original_invariants = shap.maskers._text.Text.invariants
|
18 |
+
|
19 |
+
def patched_invariants(self, *args):
|
20 |
+
# Use np.bool_ instead of the deprecated np.bool
|
21 |
+
return np.zeros(len(self._tokenized_s), dtype=np.bool_)
|
22 |
+
|
23 |
+
shap.maskers._text.Text.invariants = patched_invariants
|
24 |
+
|
25 |
# Translator instance
|
26 |
translator = GoogleTranslator(source="auto", target="es")
|
27 |
|
|
|
238 |
(joeddav/xlm-roberta-large-xnli). It automatically detects if the text is Spanish or English.
|
239 |
It uses SHAP for explainability and checks URLs against Google's Safe Browsing API for enhanced analysis.
|
240 |
""",
|
241 |
+
flagging_mode="never"
|
242 |
)
|
243 |
|
244 |
if __name__ == "__main__":
|