fffiloni commited on
Commit
4fe203e
1 Parent(s): 1ab8dc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,7 +23,7 @@ device="cpu"
23
  img_pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
24
  img_pipe.to(device)
25
 
26
- source_img = gr.Image(source="upload", type="filepath", label="init_img")
27
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
28
 
29
  def resize(height,img):
@@ -37,7 +37,7 @@ def resize(height,img):
37
 
38
  def infer(prompt, source_img):
39
 
40
- source_image = resize(512,source_img)
41
  source_image.save('source.png')
42
  images_list = img_pipe([prompt] * 2, init_image=source_image, strength=0.75)
43
  images = []
 
23
  img_pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
24
  img_pipe.to(device)
25
 
26
+ source_img = gr.Image(source="upload", type="filepath", label="init_img | 512*512 px")
27
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
28
 
29
  def resize(height,img):
 
37
 
38
  def infer(prompt, source_img):
39
 
40
+ source_image = source_img.resize((512,512), Image.Resampling.LANCZOS)
41
  source_image.save('source.png')
42
  images_list = img_pipe([prompt] * 2, init_image=source_image, strength=0.75)
43
  images = []