Spaces:
Runtime error
Runtime error
Update remove_bg.py
Browse files- remove_bg.py +3 -3
remove_bg.py
CHANGED
@@ -36,9 +36,9 @@ class RemoveBackground(object):
|
|
36 |
input_batch = input_tensor.unsqueeze(0) # create a mini-batch as expected by the model
|
37 |
|
38 |
# move the input and model to GPU for speed if available
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
with torch.no_grad():
|
44 |
output = self.model(input_batch)['out'][0]
|
|
|
36 |
input_batch = input_tensor.unsqueeze(0) # create a mini-batch as expected by the model
|
37 |
|
38 |
# move the input and model to GPU for speed if available
|
39 |
+
if torch.cuda.is_available():
|
40 |
+
input_batch = input_batch.to('cuda')
|
41 |
+
self.model.to('cuda')
|
42 |
|
43 |
with torch.no_grad():
|
44 |
output = self.model(input_batch)['out'][0]
|