amazonaws-la commited on
Commit
d2e502d
1 Parent(s): 99bbdb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -11,8 +11,9 @@ import spaces
11
  import requests
12
  import torch
13
  from io import BytesIO
14
- from PIL import Image
15
  from diffusers import StableDiffusionImg2ImgPipeline, AutoencoderKL, DiffusionPipeline
 
16
 
17
  DESCRIPTION = "# SDXL"
18
  if not torch.cuda.is_available():
@@ -73,9 +74,8 @@ def generate(
73
  pipe.fuse_lora(lora_scale=0.7)
74
 
75
  url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
76
- response = requests.get(url)
77
- init_img = Image.open(BytesIO(response.content)).convert("RGB")
78
- init_img = init_img.resize((1024, 1024))
79
 
80
  if ENABLE_CPU_OFFLOAD:
81
  pipe.enable_model_cpu_offload()
 
11
  import requests
12
  import torch
13
  from io import BytesIO
14
+ from PIL.Image
15
  from diffusers import StableDiffusionImg2ImgPipeline, AutoencoderKL, DiffusionPipeline
16
+ from diffusers.utils import load_image
17
 
18
  DESCRIPTION = "# SDXL"
19
  if not torch.cuda.is_available():
 
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()