Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import numpy as np
|
|
| 10 |
import spaces
|
| 11 |
import requests
|
| 12 |
import torch
|
| 13 |
-
import
|
| 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 |
-
|
| 78 |
-
|
|
|
|
| 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()
|