Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,8 +82,9 @@ except Exception as e:
|
|
| 82 |
processor = None
|
| 83 |
|
| 84 |
# SAM Wrapper
|
| 85 |
-
|
| 86 |
class CustomSAMWrapper:
|
|
|
|
| 87 |
def __init__(self, model_path: str, device: str = DEVICE):
|
| 88 |
# try:
|
| 89 |
self.device = torch.device(device)
|
|
@@ -95,7 +96,7 @@ class CustomSAMWrapper:
|
|
| 95 |
# except Exception as e:
|
| 96 |
# print(f"Error loading SAM model: {e}")
|
| 97 |
# self.predictor = None
|
| 98 |
-
|
| 99 |
def predict(self, image: PILImage.Image,
|
| 100 |
points: List[Tuple[int, int]],
|
| 101 |
labels: List[int],
|
|
|
|
| 82 |
processor = None
|
| 83 |
|
| 84 |
# SAM Wrapper
|
| 85 |
+
|
| 86 |
class CustomSAMWrapper:
|
| 87 |
+
@spaces.GPU
|
| 88 |
def __init__(self, model_path: str, device: str = DEVICE):
|
| 89 |
# try:
|
| 90 |
self.device = torch.device(device)
|
|
|
|
| 96 |
# except Exception as e:
|
| 97 |
# print(f"Error loading SAM model: {e}")
|
| 98 |
# self.predictor = None
|
| 99 |
+
@spaces.GPU
|
| 100 |
def predict(self, image: PILImage.Image,
|
| 101 |
points: List[Tuple[int, int]],
|
| 102 |
labels: List[int],
|