fffiloni commited on
Commit
aaa8826
1 Parent(s): a0e63b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -26,12 +26,13 @@ img_pipe.to(device)
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):
30
- baseheight = height
31
  img = Image.open(img)
32
- hpercent = (baseheight/float(img.size[1]))
33
- wsize = int((float(img.size[0])*float(hpercent)))
34
- img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
 
35
  return img
36
 
37
 
@@ -54,4 +55,4 @@ print("Great sylvain ! Everything is working fine !")
54
  title="Img2Img Stable Diffusion CPU"
55
  description="Img2Img Stable Diffusion example using CPU and HF token. <br />Warning: Slow process... ~5/10 min inference time. <b>NSFW filter enabled.</b>"
56
 
57
- gr.Interface(fn=infer, inputs=["text", source_img], outputs=gallery,title=title,description=description).launch(enable_queue=True)
 
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(value,img):
30
+ #baseheight = value
31
  img = Image.open(img)
32
+ #hpercent = (baseheight/float(img.size[1]))
33
+ #wsize = int((float(img.size[0])*float(hpercent)))
34
+ #img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
35
+ img = img.resize((value,value), Image.Resampling.LANCZOS)
36
  return img
37
 
38
 
 
55
  title="Img2Img Stable Diffusion CPU"
56
  description="Img2Img Stable Diffusion example using CPU and HF token. <br />Warning: Slow process... ~5/10 min inference time. <b>NSFW filter enabled.</b>"
57
 
58
+ gr.Interface(fn=infer, inputs=["text", source_img], outputs=gallery,title=title,description=description).queue(max_size=4).launch(enable_queue=True)