Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,12 @@ device="cpu"
|
|
20 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
|
21 |
pipe.to(device)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
24 |
|
25 |
def resize(width,img):
|
@@ -50,4 +56,4 @@ print("Great sylvain ! Everything is working fine !")
|
|
50 |
title="Stable Diffusion CPU"
|
51 |
description="Stable Diffusion example using CPU and HF token. <br />Warning: Slow process... ~5/10 min inference time. <b>NSFW filter enabled.</b>"
|
52 |
|
53 |
-
gr.Interface(fn=infer, inputs=["text",
|
|
|
20 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
|
21 |
pipe.to(device)
|
22 |
|
23 |
+
source_img = gr.Image(image_mode="RGB",
|
24 |
+
source="upload",
|
25 |
+
type="file",
|
26 |
+
shape=None,
|
27 |
+
invert_colors=False)
|
28 |
+
|
29 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
30 |
|
31 |
def resize(width,img):
|
|
|
56 |
title="Stable Diffusion CPU"
|
57 |
description="Stable Diffusion example using CPU and HF token. <br />Warning: Slow process... ~5/10 min inference time. <b>NSFW filter enabled.</b>"
|
58 |
|
59 |
+
gr.Interface(fn=infer, inputs=["text", source_img], outputs=gallery,title=title,description=description).launch(enable_queue=True)
|