Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -191,6 +191,13 @@ def resize_dimensions(dimensions, target_size):
|
|
191 |
def flush():
|
192 |
gc.collect()
|
193 |
torch.cuda.empty_cache()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
class ControlNetDepthDesignModelMulti:
|
196 |
""" Produces random noise images """
|
@@ -332,12 +339,6 @@ def create_demo(model):
|
|
332 |
design_image = gr.Image(label="Output Mask", elem_id='img-display-output')
|
333 |
with gr.Column():
|
334 |
bboxes = gr.JSON(label="Detected Objects", elem_id='json-display-output')
|
335 |
-
|
336 |
-
def clear_gpu():
|
337 |
-
pipe = pipe.to("cpu")
|
338 |
-
guide_pipe = guide_pipe.to("cpu")
|
339 |
-
depth_estimator = depth_estimator.to("cpu")
|
340 |
-
torch.cuda.empty_cache()
|
341 |
|
342 |
def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt,
|
343 |
img_size, detr_confidence_threshold=0.8):
|
|
|
191 |
def flush():
|
192 |
gc.collect()
|
193 |
torch.cuda.empty_cache()
|
194 |
+
|
195 |
+
@spaces.GPU
|
196 |
+
def clear_gpu():
|
197 |
+
pipe = pipe.to("cpu")
|
198 |
+
guide_pipe = guide_pipe.to("cpu")
|
199 |
+
depth_estimator = depth_estimator.to("cpu")
|
200 |
+
torch.cuda.empty_cache()
|
201 |
|
202 |
class ControlNetDepthDesignModelMulti:
|
203 |
""" Produces random noise images """
|
|
|
339 |
design_image = gr.Image(label="Output Mask", elem_id='img-display-output')
|
340 |
with gr.Column():
|
341 |
bboxes = gr.JSON(label="Detected Objects", elem_id='json-display-output')
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt,
|
344 |
img_size, detr_confidence_threshold=0.8):
|