Spaces:
Sleeping
Sleeping
Correct, model referencing before assignment
Browse files- demo_gradio.py +2 -1
demo_gradio.py
CHANGED
|
@@ -66,9 +66,10 @@ def get_model_on_device(device: torch.device):
|
|
| 66 |
# **Function to Process Image Once**
|
| 67 |
@spaces.GPU
|
| 68 |
def process_image_once(inputs, enable_mask):
|
| 69 |
-
|
| 70 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 71 |
model = get_model_on_device(device)
|
|
|
|
| 72 |
image = inputs["image"]
|
| 73 |
drawn_boxes = inputs["points"]
|
| 74 |
image_tensor = torch.tensor(image).to(device)
|
|
|
|
| 66 |
# **Function to Process Image Once**
|
| 67 |
@spaces.GPU
|
| 68 |
def process_image_once(inputs, enable_mask):
|
| 69 |
+
|
| 70 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 71 |
model = get_model_on_device(device)
|
| 72 |
+
model.module.return_masks = enable_mask
|
| 73 |
image = inputs["image"]
|
| 74 |
drawn_boxes = inputs["points"]
|
| 75 |
image_tensor = torch.tensor(image).to(device)
|