Spaces:
Runtime error
Runtime error
Lykon/dreamshaper-xl-v2-turbo
Browse files
app.py
CHANGED
@@ -8,12 +8,19 @@ from PIL import Image
|
|
8 |
from diffusers import AutoPipelineForImage2Image
|
9 |
from diffusers.utils import load_image
|
10 |
import math
|
|
|
|
|
11 |
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
12 |
|
13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
14 |
-
pipe = AutoPipelineForImage2Image.from_pretrained("Lykon/dreamshaper-
|
15 |
pipe = pipe.to(device)
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
def resize(value,img):
|
18 |
img = Image.open(img)
|
19 |
img = img.resize((value,value))
|
|
|
8 |
from diffusers import AutoPipelineForImage2Image
|
9 |
from diffusers.utils import load_image
|
10 |
import math
|
11 |
+
from DeepCache import DeepCacheSDHelper
|
12 |
+
|
13 |
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
14 |
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
+
pipe = AutoPipelineForImage2Image.from_pretrained("Lykon/dreamshaper-xl-v2-turbo", torch_dtype=torch.float16) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo")
|
17 |
pipe = pipe.to(device)
|
18 |
+
helper = DeepCacheSDHelper(pipe=pipe)
|
19 |
+
helper.set_params(
|
20 |
+
cache_interval=3,
|
21 |
+
cache_branch_id=0,
|
22 |
+
)
|
23 |
+
helper.enable()
|
24 |
def resize(value,img):
|
25 |
img = Image.open(img)
|
26 |
img = img.resize((value,value))
|