@@ -449,6 +449,7 @@ def create_detector( # noqa: PLR0913
449449 patience_time = patience_time ,
450450 pipeline_config = pipeline_config ,
451451 metadata = metadata ,
452+ ** kwargs ,
452453 )
453454 if mode == ModeEnum .COUNT :
454455 if class_names is None :
@@ -464,6 +465,7 @@ def create_detector( # noqa: PLR0913
464465 patience_time = patience_time ,
465466 pipeline_config = pipeline_config ,
466467 metadata = metadata ,
468+ ** kwargs ,
467469 )
468470 if mode == ModeEnum .MULTI_CLASS :
469471 if class_names is None :
@@ -479,6 +481,7 @@ def create_detector( # noqa: PLR0913
479481 patience_time = patience_time ,
480482 pipeline_config = pipeline_config ,
481483 metadata = metadata ,
484+ ** kwargs ,
482485 )
483486 raise ValueError (
484487 f"Unsupported mode: { mode } , check if your desired mode is only supported in the ExperimentalApi"
@@ -786,7 +789,7 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t
786789
787790 if wait > 0 :
788791 if confidence_threshold is None :
789- threshold = self .get_detector (detector ).confidence_threshold
792+ threshold = self .get_detector (detector ).confidence_threshold # TODO pass kwargs through here?
790793 else :
791794 threshold = confidence_threshold
792795 image_query = self .wait_for_confident_result (image_query , confidence_threshold = threshold , timeout_sec = wait )
@@ -1421,7 +1424,7 @@ def create_roi(self, label: str, top_left: Tuple[float, float], bottom_right: Tu
14211424 ),
14221425 )
14231426
1424- def update_detector_status (self , detector : Union [str , Detector ], enabled : bool ) -> None :
1427+ def update_detector_status (self , detector : Union [str , Detector ], enabled : bool , ** kwargs ) -> None :
14251428 """
14261429 Updates the status of the given detector. When a detector is disabled (enabled=False),
14271430 it will not accept or process any new image queries. Existing queries will not be affected.
@@ -1449,9 +1452,10 @@ def update_detector_status(self, detector: Union[str, Detector], enabled: bool)
14491452 self .detectors_api .update_detector (
14501453 detector ,
14511454 patched_detector_request = PatchedDetectorRequest (status = StatusEnum ("ON" ) if enabled else StatusEnum ("OFF" )),
1455+ _request_timeout = self ._get_request_timeout (** kwargs ),
14521456 )
14531457
1454- def update_detector_escalation_type (self , detector : Union [str , Detector ], escalation_type : str ) -> None :
1458+ def update_detector_escalation_type (self , detector : Union [str , Detector ], escalation_type : str , ** kwargs ) -> None :
14551459 """
14561460 Updates the escalation type of the given detector, controlling whether queries can be
14571461 sent to human labelers when ML confidence is low.
@@ -1490,6 +1494,7 @@ def update_detector_escalation_type(self, detector: Union[str, Detector], escala
14901494 self .detectors_api .update_detector (
14911495 detector ,
14921496 patched_detector_request = PatchedDetectorRequest (escalation_type = escalation_type ),
1497+ _request_timeout = self ._get_request_timeout (** kwargs ),
14931498 )
14941499
14951500 def create_counting_detector ( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-locals
@@ -1504,6 +1509,7 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume
15041509 patience_time : Optional [float ] = None ,
15051510 pipeline_config : Optional [str ] = None ,
15061511 metadata : Union [dict , str , None ] = None ,
1512+ ** kwargs ,
15071513 ) -> Detector :
15081514 """
15091515 Creates a counting detector that can count objects in images up to a specified maximum count.
@@ -1563,7 +1569,9 @@ def create_counting_detector( # noqa: PLR0913 # pylint: disable=too-many-argume
15631569 mode_config = CountModeConfiguration (class_name = class_name , max_count = max_count )
15641570
15651571 detector_creation_input .mode_configuration = mode_config
1566- obj = self .detectors_api .create_detector (detector_creation_input , _request_timeout = DEFAULT_REQUEST_TIMEOUT )
1572+ obj = self .detectors_api .create_detector (
1573+ detector_creation_input , _request_timeout = self ._get_request_timeout (** kwargs )
1574+ )
15671575 return Detector .parse_obj (obj .to_dict ())
15681576
15691577 def create_binary_detector ( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-locals
@@ -1576,6 +1584,7 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument
15761584 patience_time : Optional [float ] = None ,
15771585 pipeline_config : Optional [str ] = None ,
15781586 metadata : Union [dict , str , None ] = None ,
1587+ ** kwargs ,
15791588 ) -> Detector :
15801589 """
15811590 Creates a binary detector with the given name and query.
@@ -1604,7 +1613,9 @@ def create_binary_detector( # noqa: PLR0913 # pylint: disable=too-many-argument
16041613 pipeline_config = pipeline_config ,
16051614 metadata = metadata ,
16061615 )
1607- obj = self .detectors_api .create_detector (detector_creation_input , _request_timeout = DEFAULT_REQUEST_TIMEOUT )
1616+ obj = self .detectors_api .create_detector (
1617+ detector_creation_input , _request_timeout = self ._get_request_timeout (** kwargs )
1618+ )
16081619 return Detector .parse_obj (obj .to_dict ())
16091620
16101621 def create_multiclass_detector ( # noqa: PLR0913 # pylint: disable=too-many-arguments, too-many-locals
@@ -1618,6 +1629,7 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu
16181629 patience_time : Optional [float ] = None ,
16191630 pipeline_config : Optional [str ] = None ,
16201631 metadata : Union [dict , str , None ] = None ,
1632+ ** kwargs ,
16211633 ) -> Detector :
16221634 """
16231635 Creates a multiclass detector with the given name and query.
@@ -1668,5 +1680,7 @@ def create_multiclass_detector( # noqa: PLR0913 # pylint: disable=too-many-argu
16681680 detector_creation_input .mode = ModeEnum .MULTI_CLASS
16691681 mode_config = MultiClassModeConfiguration (class_names = class_names )
16701682 detector_creation_input .mode_configuration = mode_config
1671- obj = self .detectors_api .create_detector (detector_creation_input , _request_timeout = DEFAULT_REQUEST_TIMEOUT )
1683+ obj = self .detectors_api .create_detector (
1684+ detector_creation_input , _request_timeout = self ._get_request_timeout (** kwargs )
1685+ )
16721686 return Detector .parse_obj (obj .to_dict ())
0 commit comments