INNER CODE UNIT · Python
smartset
BrokenSource/DepthFlow · depthflow/scene.py:34
def smartset(self, object: Any) -> Any:
if isinstance(object, DepthEstimator):
self.estimator = object
elif isinstance(object, DepthState):
self.state = object
return object
# ------------------------------------------------------------------------ #
def commands(self):
self.cli.help = depthflow.__about__
self.cli.version = depthflow.__version__
self.cli.command(self.input)
self.cli.command(DepthState, name="state", result_action=self.smartset)
with contextlib.nullcontext("🌊 Depth Estimator") as group:
self.cli.command(DepthAnythingV1, name="da1", group=group, result_action=self.smartset)
self.cli.command(DepthAnythingV2, name="da2", group=group, result_action=self.smartset)