hackerbyhobby
commited on
more updates
Browse files
app.py
CHANGED
|
@@ -26,6 +26,11 @@ model_name = "joeddav/xlm-roberta-large-xnli"
|
|
| 26 |
classifier = pipeline("zero-shot-classification", model=model_name)
|
| 27 |
CANDIDATE_LABELS = ["SMiShing", "Other Scam", "Legitimate"]
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# SHAP explainer setup
|
| 30 |
explainer = shap.Explainer(classifier)
|
| 31 |
|
|
@@ -224,8 +229,8 @@ This tool classifies messages as SMiShing, Other Scam, or Legitimate using a zer
|
|
| 224 |
(joeddav/xlm-roberta-large-xnli). It automatically detects if the text is Spanish or English.
|
| 225 |
It uses SHAP for explainability and checks URLs against Google's Safe Browsing API for enhanced analysis.
|
| 226 |
""",
|
| 227 |
-
flagging_mode="
|
| 228 |
)
|
| 229 |
|
| 230 |
if __name__ == "__main__":
|
| 231 |
-
demo.launch()
|
|
|
|
| 26 |
classifier = pipeline("zero-shot-classification", model=model_name)
|
| 27 |
CANDIDATE_LABELS = ["SMiShing", "Other Scam", "Legitimate"]
|
| 28 |
|
| 29 |
+
# Patch shap to use np.bool_ instead of np.bool
|
| 30 |
+
shap.maskers._text.Text.mask_invariants = (
|
| 31 |
+
lambda self, *args: np.zeros(len(self._tokenized_s), dtype=np.bool_)
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
# SHAP explainer setup
|
| 35 |
explainer = shap.Explainer(classifier)
|
| 36 |
|
|
|
|
| 229 |
(joeddav/xlm-roberta-large-xnli). It automatically detects if the text is Spanish or English.
|
| 230 |
It uses SHAP for explainability and checks URLs against Google's Safe Browsing API for enhanced analysis.
|
| 231 |
""",
|
| 232 |
+
flagging_mode="never"
|
| 233 |
)
|
| 234 |
|
| 235 |
if __name__ == "__main__":
|
| 236 |
+
demo.launch()
|