Tony Neel commited on
Commit
305c627
·
1 Parent(s): bf7dfcc

satisfy huggingface init call

Browse files
Files changed (1) hide show
  1. handler.py +7 -3
handler.py CHANGED
@@ -8,8 +8,12 @@ import base64
8
  from huggingface_hub import InferenceEndpoint
9
 
10
  class EndpointHandler(InferenceEndpoint):
11
- def __init__(self):
12
- """Initialize the handler with mock predictor for local testing"""
 
 
 
 
13
  # Comment out real model for local testing
14
  self.predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-small")
15
 
@@ -32,7 +36,7 @@ class EndpointHandler(InferenceEndpoint):
32
  # mock_scores = np.array([0.9, 0.8, 0.7])
33
  # return mock_masks, mock_scores, None
34
 
35
- self.predictor = MockPredictor()
36
 
37
  def _load_image(self, image_data: Union[str, bytes]) -> Image.Image:
38
  """Load image from binary or base64 data"""
 
8
  from huggingface_hub import InferenceEndpoint
9
 
10
  class EndpointHandler(InferenceEndpoint):
11
+ def __init__(self, model_dir=None):
12
+ """Initialize the handler with mock predictor for local testing
13
+
14
+ Args:
15
+ model_dir (str, optional): Path to model directory. Defaults to None.
16
+ """
17
  # Comment out real model for local testing
18
  self.predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-small")
19
 
 
36
  # mock_scores = np.array([0.9, 0.8, 0.7])
37
  # return mock_masks, mock_scores, None
38
 
39
+ # self.predictor = MockPredictor()
40
 
41
  def _load_image(self, image_data: Union[str, bytes]) -> Image.Image:
42
  """Load image from binary or base64 data"""