Walmart-the-bag commited on
Commit
7044dfd
·
verified ·
1 Parent(s): 5ca2298
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -2,15 +2,17 @@ import gradio as gr
2
  import requests
3
  import json
4
  import time
5
- from profanity_check import predict # For NSFW detection
6
 
7
  url = "https://nexra.aryahcr.cc/api/image/complements"
8
  headers = {
9
  "Content-Type": "application/json"
10
  }
11
 
 
 
12
  def is_nsfw(text):
13
- return predict([text])[0] == 1
14
 
15
  def generate_image(prompt, model):
16
  if is_nsfw(prompt):
 
2
  import requests
3
  import json
4
  import time
5
+ from better_profanity import profanity
6
 
7
  url = "https://nexra.aryahcr.cc/api/image/complements"
8
  headers = {
9
  "Content-Type": "application/json"
10
  }
11
 
12
+ profanity.load_censor_words()
13
+
14
  def is_nsfw(text):
15
+ return profanity.contains_profanity(text)
16
 
17
  def generate_image(prompt, model):
18
  if is_nsfw(prompt):