nightfury commited on
Commit
c6bb3c2
1 Parent(s): 39a6eab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -25,19 +25,20 @@ img_pipe.to(device)
25
  source_img = gr.Image(source="upload", type="filepath", label="init_img | 512*512 px")
26
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
27
 
28
- def resize(value,img):
29
  #baseheight = value
30
  img = Image.open(img)
31
  #hpercent = (baseheight/float(img.size[1]))
32
  #wsize = int((float(img.size[0])*float(hpercent)))
33
  #img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
34
- img = img.resize((value,value), Image.Resampling.LANCZOS)
35
  return img
36
 
 
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 = []
 
25
  source_img = gr.Image(source="upload", type="filepath", label="init_img | 512*512 px")
26
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
27
 
28
+ def resize(w_val,l_val,img):
29
  #baseheight = value
30
  img = Image.open(img)
31
  #hpercent = (baseheight/float(img.size[1]))
32
  #wsize = int((float(img.size[0])*float(hpercent)))
33
  #img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
34
+ img = img.resize((w_val,l_val), Image.Resampling.LANCZOS)
35
  return img
36
 
37
+ #init_image = init_image.resize((768, 512))
38
 
39
  def infer(prompt, source_img):
40
 
41
+ source_image = resize(768, 512, source_img)
42
  source_image.save('source.png')
43
  images_list = img_pipe([prompt] * 2, init_image=source_image, strength=0.75)
44
  images = []