Update app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,13 @@ pipe.load_lora_weights(
|
|
39 |
weight_name="40kHalf.safetensors"
|
40 |
)
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
def get_canny_image(image, low_threshold=100, high_threshold=200):
|
43 |
if isinstance(image, Image.Image):
|
44 |
image = np.array(image)
|
|
|
39 |
weight_name="40kHalf.safetensors"
|
40 |
)
|
41 |
|
42 |
+
# Enable CPU offload
|
43 |
+
pipe.enable_model_cpu_offload()
|
44 |
+
|
45 |
+
# Enable memory efficient attention if available
|
46 |
+
if hasattr(pipe, "enable_xformers_memory_efficient_attention"):
|
47 |
+
pipe.enable_xformers_memory_efficient_attention()
|
48 |
+
|
49 |
def get_canny_image(image, low_threshold=100, high_threshold=200):
|
50 |
if isinstance(image, Image.Image):
|
51 |
image = np.array(image)
|