Krebzonide
commited on
Commit
·
0e93213
1
Parent(s):
69f6513
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
import gradio as gr
|
6 |
|
7 |
model_id = int(os.getenv("Model"))
|
|
|
8 |
|
9 |
#stable-diffusion-xl-base-1.0 0 - base model
|
10 |
#Colossus_Project_XL 1 - better people
|
@@ -21,6 +22,9 @@ model_url_list = ["stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base
|
|
21 |
"SG161222/RealVisXL_V2.0/blob/main/RealVisXL_V2.0.safetensors",
|
22 |
"Krebzonide/AcornIsSpinning_acornXLV1/blob/main/acornIsSpinning_acornxlV1.safetensors"]
|
23 |
|
|
|
|
|
|
|
24 |
css = """
|
25 |
.btn-green {
|
26 |
background-image: linear-gradient(to bottom right, #6dd178, #00a613) !important;
|
@@ -33,6 +37,10 @@ css = """
|
|
33 |
"""
|
34 |
|
35 |
def generate(prompt, neg_prompt, samp_steps, cfg_scale, batch_size, seed, height, width, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
36 |
if seed < 0:
|
37 |
seed = random.randint(1,999999)
|
38 |
images = pipe(
|
|
|
5 |
import gradio as gr
|
6 |
|
7 |
model_id = int(os.getenv("Model"))
|
8 |
+
nsfw_filter = int(os.getenv("Safe"))
|
9 |
|
10 |
#stable-diffusion-xl-base-1.0 0 - base model
|
11 |
#Colossus_Project_XL 1 - better people
|
|
|
22 |
"SG161222/RealVisXL_V2.0/blob/main/RealVisXL_V2.0.safetensors",
|
23 |
"Krebzonide/AcornIsSpinning_acornXLV1/blob/main/acornIsSpinning_acornxlV1.safetensors"]
|
24 |
|
25 |
+
naughtyWords = ["nude", "nsfw", "naked", "porn", "boob", "tit", "nipple", "vagina", "pussy", "panties", "underwear", "upskirt", "bottomless", "topless", "petite", "xxx"]
|
26 |
+
|
27 |
+
|
28 |
css = """
|
29 |
.btn-green {
|
30 |
background-image: linear-gradient(to bottom right, #6dd178, #00a613) !important;
|
|
|
37 |
"""
|
38 |
|
39 |
def generate(prompt, neg_prompt, samp_steps, cfg_scale, batch_size, seed, height, width, progress=gr.Progress(track_tqdm=True)):
|
40 |
+
if nsfw_filter:
|
41 |
+
for word in naughtyWords:
|
42 |
+
if prompt.find(word) > 0:
|
43 |
+
return None 58008
|
44 |
if seed < 0:
|
45 |
seed = random.randint(1,999999)
|
46 |
images = pipe(
|