Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,10 @@ try_cuda = not args.disable_cuda
|
|
26 |
torch.inference_mode()
|
27 |
torch.no_grad()
|
28 |
|
|
|
|
|
|
|
|
|
29 |
device = get_device(try_cuda=try_cuda)
|
30 |
|
31 |
# Load segmentation models
|
@@ -45,10 +49,6 @@ def load_diffusion_pipeline(model_name: str = 'stabilityai/stable-diffusion-2-in
|
|
45 |
use_auth_token=auth_token
|
46 |
)
|
47 |
|
48 |
-
# Device helper
|
49 |
-
def get_device(try_cuda=True):
|
50 |
-
return torch.device('cuda' if try_cuda and torch.cuda.is_available() else 'cpu')
|
51 |
-
|
52 |
def min_pool(x: torch.Tensor, kernel_size: int):
|
53 |
pad_size = (kernel_size - 1) // 2
|
54 |
return -torch.nn.functional.max_pool2d(-x, kernel_size, (1, 1), padding=pad_size)
|
|
|
26 |
torch.inference_mode()
|
27 |
torch.no_grad()
|
28 |
|
29 |
+
# Device helper
|
30 |
+
def get_device(try_cuda=True):
|
31 |
+
return torch.device('cuda' if try_cuda and torch.cuda.is_available() else 'cpu')
|
32 |
+
|
33 |
device = get_device(try_cuda=try_cuda)
|
34 |
|
35 |
# Load segmentation models
|
|
|
49 |
use_auth_token=auth_token
|
50 |
)
|
51 |
|
|
|
|
|
|
|
|
|
52 |
def min_pool(x: torch.Tensor, kernel_size: int):
|
53 |
pad_size = (kernel_size - 1) // 2
|
54 |
return -torch.nn.functional.max_pool2d(-x, kernel_size, (1, 1), padding=pad_size)
|