Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,8 +13,6 @@ 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
|
| 17 |
-
from safety_checker import StableDiffusionSafetyChecker
|
| 18 |
|
| 19 |
DESCRIPTION = "# SDXL"
|
| 20 |
if not torch.cuda.is_available():
|
|
@@ -64,7 +62,6 @@ def generate(
|
|
| 64 |
if torch.cuda.is_available():
|
| 65 |
|
| 66 |
if not use_vae:
|
| 67 |
-
safety_checker = StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
| 68 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
| 69 |
|
| 70 |
if use_vae:
|
|
@@ -76,7 +73,7 @@ def generate(
|
|
| 76 |
pipe.fuse_lora(lora_scale=0.7)
|
| 77 |
|
| 78 |
response = requests.get("https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg")
|
| 79 |
-
init_image = Image.open(
|
| 80 |
init_image = init_image.resize((1024, 1024))
|
| 81 |
|
| 82 |
if ENABLE_CPU_OFFLOAD:
|
|
|
|
| 13 |
from PIL import Image
|
| 14 |
from io import BytesIO
|
| 15 |
from diffusers import StableDiffusionImg2ImgPipeline, AutoencoderKL, DiffusionPipeline
|
|
|
|
|
|
|
| 16 |
|
| 17 |
DESCRIPTION = "# SDXL"
|
| 18 |
if not torch.cuda.is_available():
|
|
|
|
| 62 |
if torch.cuda.is_available():
|
| 63 |
|
| 64 |
if not use_vae:
|
|
|
|
| 65 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
| 66 |
|
| 67 |
if use_vae:
|
|
|
|
| 73 |
pipe.fuse_lora(lora_scale=0.7)
|
| 74 |
|
| 75 |
response = requests.get("https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg")
|
| 76 |
+
init_image = Image.open(img)
|
| 77 |
init_image = init_image.resize((1024, 1024))
|
| 78 |
|
| 79 |
if ENABLE_CPU_OFFLOAD:
|