Spaces:
Running
on
Zero
Running
on
Zero
Plat
commited on
Commit
β’
72d34e5
1
Parent(s):
99a7d5d
maybe cuda
Browse files
app.py
CHANGED
@@ -87,6 +87,8 @@ pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.conf
|
|
87 |
pipe.unet.set_attn_processor(AttnProcessor2_0())
|
88 |
if device == "cuda":
|
89 |
pipe.enable_sequential_cpu_offload(gpu_id=0, device="cuda")
|
|
|
|
|
90 |
|
91 |
|
92 |
def get_aspect_ratio(width: int, height: int) -> str:
|
@@ -140,7 +142,7 @@ def format_prompt(prompt: str, prompt_suffix: str):
|
|
140 |
return f"{prompt}, {prompt_suffix}"
|
141 |
|
142 |
|
143 |
-
@spaces.GPU
|
144 |
def generate_image(
|
145 |
prompt: str,
|
146 |
negative_prompt: str,
|
|
|
87 |
pipe.unet.set_attn_processor(AttnProcessor2_0())
|
88 |
if device == "cuda":
|
89 |
pipe.enable_sequential_cpu_offload(gpu_id=0, device="cuda")
|
90 |
+
else:
|
91 |
+
pipe = pipe.to("cuda") # for spaces
|
92 |
|
93 |
|
94 |
def get_aspect_ratio(width: int, height: int) -> str:
|
|
|
142 |
return f"{prompt}, {prompt_suffix}"
|
143 |
|
144 |
|
145 |
+
@spaces.GPU(duration=30)
|
146 |
def generate_image(
|
147 |
prompt: str,
|
148 |
negative_prompt: str,
|