Spaces:
Running
Running
- helper_regex.py +17 -0
helper_regex.py
CHANGED
@@ -13,6 +13,23 @@ import json
|
|
13 |
|
14 |
WHITELIST_WORDS = {"eval", "admin", "bot", "python", "ok", "done", "anti"}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def check_anti_word_by_ryzenth(text: str):
|
17 |
response = requests.get(
|
18 |
f"https://randydev-ryu-js.hf.space/api/v1/ai/akenox/antievalai-v2?query={text}",
|
|
|
13 |
|
14 |
WHITELIST_WORDS = {"eval", "admin", "bot", "python", "ok", "done", "anti"}
|
15 |
|
16 |
+
def check_anti_word_by_ryzenth(text: str):
|
17 |
+
reason = ""
|
18 |
+
try:
|
19 |
+
response = requests.get(
|
20 |
+
f"https://randydev-ryu-js.hf.space/api/v1/ai/akenox/antievalai-v2?query={text}",
|
21 |
+
headers={"x-api-key": "test"}
|
22 |
+
).json()
|
23 |
+
ok = json.loads(response["results"])
|
24 |
+
|
25 |
+
if ok.get("reason"):
|
26 |
+
reason += ok["reason"]
|
27 |
+
if ok.get("is_detect") is True:
|
28 |
+
return True, reason
|
29 |
+
return False, reason
|
30 |
+
except (json.decoder.JSONDecodeError, KeyError, TypeError):
|
31 |
+
return False, reason
|
32 |
+
|
33 |
def check_anti_word_by_ryzenth(text: str):
|
34 |
response = requests.get(
|
35 |
f"https://randydev-ryu-js.hf.space/api/v1/ai/akenox/antievalai-v2?query={text}",
|