Spaces:
Runtime error
Runtime error
ban nsfw
Browse files
app.py
CHANGED
|
@@ -2,15 +2,17 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
import json
|
| 4 |
import time
|
| 5 |
-
from
|
| 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
|
| 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):
|