Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,11 +21,10 @@ pipe.to(device)
|
|
| 21 |
|
| 22 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 23 |
|
| 24 |
-
def infer(prompt):
|
| 25 |
-
|
| 26 |
|
| 27 |
#image = pipe(prompt, init_image=init_image)["sample"][0]
|
| 28 |
-
images_list = pipe([prompt] *
|
| 29 |
images = []
|
| 30 |
safe_image = Image.open(r"unsafe.png")
|
| 31 |
for i, image in enumerate(images_list["sample"]):
|
|
@@ -33,12 +32,13 @@ def infer(prompt):
|
|
| 33 |
images.append(safe_image)
|
| 34 |
else:
|
| 35 |
images.append(image)
|
|
|
|
| 36 |
return images
|
| 37 |
|
| 38 |
print("Great sylvain ! Everything is working fine !")
|
| 39 |
|
| 40 |
title="Stable Diffusion CPU"
|
| 41 |
-
description="Stable Diffusion example using CPU and HF token. Warning: Slow process... ~5/10 min inference time"
|
| 42 |
|
| 43 |
gr.Interface(fn=infer, inputs="text", outputs=gallery,title=title,description=description).launch(enable_queue=True)
|
| 44 |
|
|
|
|
| 21 |
|
| 22 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 23 |
|
| 24 |
+
def infer(prompt):
|
|
|
|
| 25 |
|
| 26 |
#image = pipe(prompt, init_image=init_image)["sample"][0]
|
| 27 |
+
images_list = pipe([prompt] * 4)
|
| 28 |
images = []
|
| 29 |
safe_image = Image.open(r"unsafe.png")
|
| 30 |
for i, image in enumerate(images_list["sample"]):
|
|
|
|
| 32 |
images.append(safe_image)
|
| 33 |
else:
|
| 34 |
images.append(image)
|
| 35 |
+
|
| 36 |
return images
|
| 37 |
|
| 38 |
print("Great sylvain ! Everything is working fine !")
|
| 39 |
|
| 40 |
title="Stable Diffusion CPU"
|
| 41 |
+
description="Stable Diffusion example using CPU and HF token. <br />Warning: Slow process... ~5/10 min inference time. <b>NSFW filter enabled.</b>"
|
| 42 |
|
| 43 |
gr.Interface(fn=infer, inputs="text", outputs=gallery,title=title,description=description).launch(enable_queue=True)
|
| 44 |
|