From 4f05a0bbc6c15401b1ec016184399bd618fcf929 Mon Sep 17 00:00:00 2001 From: genia10 Date: Sat, 14 Oct 2023 03:22:55 +0300 Subject: [PATCH] check profanity en --- model/censor/research/NSWF.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/censor/research/NSWF.py b/model/censor/research/NSWF.py index bebd522..0b37ba1 100644 --- a/model/censor/research/NSWF.py +++ b/model/censor/research/NSWF.py @@ -1,5 +1,6 @@ import opennsfw2 as n2 from rus_rule_based_insult_classifier.core import insult_classifier +from better_profanity import profanity def check_nudity_one(image_path): nsfw_probability = n2.predict_image(image_path) @@ -16,4 +17,7 @@ def check_nudity_lot(image_paths): #pip install git+https://github.com/kudep/rus_rule_based_insult_classifier def check_profanity_ru(text): - return insult_classifier(text) \ No newline at end of file + return insult_classifier(text) + +def check_profanity_en(text): + return profanity.contains_profanity(text) \ No newline at end of file