Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,14 +17,15 @@ def load_model():
|
|
17 |
)
|
18 |
if torch.cuda.is_available():
|
19 |
pipe.to("cuda")
|
20 |
-
# Enable memory optimizations
|
21 |
pipe.enable_attention_slicing()
|
|
|
22 |
return pipe
|
23 |
|
24 |
def generate_image(prompt, negative_prompt, steps=30, guidance_scale=7.5):
|
25 |
pipe = load_model()
|
26 |
|
27 |
-
# Generate image with
|
28 |
image = pipe(
|
29 |
prompt=prompt,
|
30 |
negative_prompt=negative_prompt,
|
|
|
17 |
)
|
18 |
if torch.cuda.is_available():
|
19 |
pipe.to("cuda")
|
20 |
+
# Enable memory optimizations
|
21 |
pipe.enable_attention_slicing()
|
22 |
+
pipe.enable_model_cpu_offload()
|
23 |
return pipe
|
24 |
|
25 |
def generate_image(prompt, negative_prompt, steps=30, guidance_scale=7.5):
|
26 |
pipe = load_model()
|
27 |
|
28 |
+
# Generate image with reduced resolution for stability
|
29 |
image = pipe(
|
30 |
prompt=prompt,
|
31 |
negative_prompt=negative_prompt,
|