amazonaws-la commited on
Commit
1b4965b
1 Parent(s): a03df45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -10,7 +10,7 @@ import numpy as np
10
  import spaces
11
  import requests
12
  import torch
13
- import PIL.Image
14
  from io import BytesIO
15
  from diffusers import StableDiffusionImg2ImgPipeline, AutoencoderKL, DiffusionPipeline
16
  from diffusers.utils import load_image
@@ -74,8 +74,9 @@ def generate(
74
  pipe.fuse_lora(lora_scale=0.7)
75
 
76
  url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
77
- img = Image.open(img)
78
- img = img.resize((1024,1024))
 
79
 
80
  if ENABLE_CPU_OFFLOAD:
81
  pipe.enable_model_cpu_offload()
 
10
  import spaces
11
  import requests
12
  import torch
13
+ from PIL import Image
14
  from io import BytesIO
15
  from diffusers import StableDiffusionImg2ImgPipeline, AutoencoderKL, DiffusionPipeline
16
  from diffusers.utils import load_image
 
74
  pipe.fuse_lora(lora_scale=0.7)
75
 
76
  url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
77
+ response = requests.get(url)
78
+ init_image = Image.open(BytesIO(response.content)).convert("RGB")
79
+ init_image = init_image.resize((1024, 1024))
80
 
81
  if ENABLE_CPU_OFFLOAD:
82
  pipe.enable_model_cpu_offload()