nightfury commited on
Commit
60383f5
1 Parent(s): 489a5bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -11,14 +11,16 @@ device="cpu"
11
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=st.secrets['USER_TOKEN'])
12
  pipe.to(device)
13
 
14
- def resize(value,img):
15
  img = Image.open(img)
16
- img = img.resize((value,value), Image.Resampling.LANCZOS)
 
17
  return img
18
 
 
19
  def infer(source_img, prompt, guide, steps, seed, Strength):
20
  generator = torch.Generator('cpu').manual_seed(seed)
21
- source_image = resize(512, source_img)
22
  source_image.save('source.png')
23
  image_list = pipe([prompt], init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps)
24
  images = []
 
11
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=st.secrets['USER_TOKEN'])
12
  pipe.to(device)
13
 
14
+ def resize(w_val,l_val,img):
15
  img = Image.open(img)
16
+ img = img.resize((w_val,l_val), Image.Resampling.LANCZOS)
17
+ #img = img.resize((value,value), Image.Resampling.LANCZOS)
18
  return img
19
 
20
+
21
  def infer(source_img, prompt, guide, steps, seed, Strength):
22
  generator = torch.Generator('cpu').manual_seed(seed)
23
+ source_image = resize(768, 512, source_img)
24
  source_image.save('source.png')
25
  image_list = pipe([prompt], init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps)
26
  images = []