(
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,
)
| 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 | |
| 45 | class Sam3ServicePool: |
nothing calls this directly
no outgoing calls
no test coverage detected