amazonaws-sp commited on
Commit
a2b83e4
·
verified ·
1 Parent(s): a956827

Update app.py

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