fffiloni commited on
Commit
97126d6
1 Parent(s): 150f210

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
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","image"], outputs=gallery,title=title,description=description).launch(enable_queue=True)
 
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)