MCPcopy Create free account
hub / github.com/BIT-DataLab/Edit-Banana / predict

Method predict

sam3_service/client.py:17–42  ·  view source on GitHub ↗
(
        self,
        image_path: str,
        prompts: List[str],
        return_masks: bool = False,
        mask_format: Literal["rle", "png"] = "rle",
        score_threshold: Optional[float] = None,
        epsilon_factor: Optional[float] = None,
        min_area: Optional[int] = None,
    )

Source from the content-addressed store, hash-verified

15 return resp.status_code == 200
16
17 def predict(
18 self,
19 image_path: str,
20 prompts: List[str],
21 return_masks: bool = False,
22 mask_format: Literal["rle", "png"] = "rle",
23 score_threshold: Optional[float] = None,
24 epsilon_factor: Optional[float] = None,
25 min_area: Optional[int] = None,
26 ) -> Dict:
27 payload = {
28 "image_path": image_path,
29 "prompts": prompts,
30 "return_masks": return_masks,
31 "mask_format": mask_format,
32 }
33 if score_threshold is not None:
34 payload["score_threshold"] = score_threshold
35 if epsilon_factor is not None:
36 payload["epsilon_factor"] = epsilon_factor
37 if min_area is not None:
38 payload["min_area"] = min_area
39
40 resp = requests.post(f"{self.base_url}/predict", json=payload, timeout=self.timeout)
41 resp.raise_for_status()
42 return resp.json()
43
44
45class Sam3ServicePool:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected