


from ..utils import requires_backends


_snake_case					=					None
class      UpperCAmelCase_ :

   '''simple docstring'''




   def __init__(		self						,    *__A						,    **__A			):






     """simple docstring"""





     requires_backends(self						,    ["detectron2"]			)






   @classmethod
   def _snake_case   (		cls						,    *__A						,    **__A			):






     """simple docstring"""





     requires_backends(cls						,    ["detectron2"]			)







import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
   from PIL import Image
class      UpperCAmelCase_ ( unittest.TestCase		,			UpperCamelCase   ):

   '''simple docstring'''




   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: List[Any]   =    load_tool("image-segmentation"			)
     self.tool.setup()
     lowerCamelCase			: Optional[Any]   =    load_tool("image-segmentation"						,    remote=__A			)






   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: List[str]   =    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"			)			) / "000000039769.png"			)
     lowerCamelCase			: Dict   =    self.tool(__A						,    "cat"			)
     self.assertTrue(isinstance(__A						,    Image.Image			)			)






   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: int   =    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"			)			) / "000000039769.png"			)
     lowerCamelCase			: int   =    self.remote_tool(__A						,    "cat"			)
     self.assertTrue(isinstance(__A						,    Image.Image			)			)






   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: Optional[int]   =    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"			)			) / "000000039769.png"			)
     lowerCamelCase			: Optional[Any]   =    self.tool(image=__A						,    label="cat"			)
     self.assertTrue(isinstance(__A						,    Image.Image			)			)






   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: str   =    Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"			)			) / "000000039769.png"			)
     lowerCamelCase			: Dict   =    self.remote_tool(image=__A						,    label="cat"			)
     self.assertTrue(isinstance(__A						,    Image.Image			)			)



