amazonaws-sp commited on
Commit
9af8f7c
·
verified ·
1 Parent(s): ae00222

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -59,10 +59,13 @@ def generate(
59
 
60
  if not use_vae:
61
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
62
- response = requests.get("https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg")
63
- image_bytes = BytesIO(response.content)
64
- init_image = Image.open(image_bytes).convert("RGB")
65
- init_image = init_image.resize((768, 512))
 
 
 
66
 
67
  if use_vae:
68
  vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
 
59
 
60
  if not use_vae:
61
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
62
+ img = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
63
+ def resize(value,img):
64
+ img = Image.open(img)
65
+ img = img.resize((value,value))
66
+ return img
67
+ source_image = resize(768, source_img)
68
+ source_image.save('source.png')
69
 
70
  if use_vae:
71
  vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)