Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
#243
by
WildZooGuy
- opened
app.py
CHANGED
@@ -20,10 +20,6 @@ word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt",
|
|
20 |
word_list = word_list_dataset["train"]['text']
|
21 |
|
22 |
def infer(prompt, samples, steps, scale, seed):
|
23 |
-
#When running locally you can also remove this filter
|
24 |
-
for filter in word_list:
|
25 |
-
if re.search(rf"\b{filter}\b", prompt):
|
26 |
-
raise gr.Error("Unsafe content found. Please try again with different prompts.")
|
27 |
|
28 |
generator = torch.Generator(device=device).manual_seed(seed)
|
29 |
|
@@ -36,10 +32,7 @@ def infer(prompt, samples, steps, scale, seed):
|
|
36 |
images = []
|
37 |
safe_image = Image.open(r"unsafe.png")
|
38 |
for i, image in enumerate(images_list["sample"]):
|
39 |
-
|
40 |
-
images.append(safe_image)
|
41 |
-
else:
|
42 |
-
images.append(image)
|
43 |
return images
|
44 |
|
45 |
css = """
|
|
|
20 |
word_list = word_list_dataset["train"]['text']
|
21 |
|
22 |
def infer(prompt, samples, steps, scale, seed):
|
|
|
|
|
|
|
|
|
23 |
|
24 |
generator = torch.Generator(device=device).manual_seed(seed)
|
25 |
|
|
|
32 |
images = []
|
33 |
safe_image = Image.open(r"unsafe.png")
|
34 |
for i, image in enumerate(images_list["sample"]):
|
35 |
+
images.append(image)
|
|
|
|
|
|
|
36 |
return images
|
37 |
|
38 |
css = """
|