




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 	lowercase_      (			unittest.TestCase				,						lowerCAmelCase_     ):






      '''simple docstring'''




      def    __lowerCAmelCase      (   self   :		Tuple						)					->str:




       """simple docstring"""


       a							=   load_tool('''image-segmentation'''						)
       self.tool.setup()
       a							=   load_tool('''image-segmentation'''				,      remote=__SCREAMING_SNAKE_CASE						)







      def    __lowerCAmelCase      (   self   :		List[str]						)					->Optional[Any]:




       """simple docstring"""


       a							=   Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''						)						) / '''000000039769.png'''						)
       a							=   self.tool(__SCREAMING_SNAKE_CASE				,      '''cat'''						)
       self.assertTrue(isinstance(__SCREAMING_SNAKE_CASE				,      Image.Image						)						)







      def    __lowerCAmelCase      (   self   :		Tuple						)					->Dict:




       """simple docstring"""


       a							=   Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''						)						) / '''000000039769.png'''						)
       a							=   self.remote_tool(__SCREAMING_SNAKE_CASE				,      '''cat'''						)
       self.assertTrue(isinstance(__SCREAMING_SNAKE_CASE				,      Image.Image						)						)







      def    __lowerCAmelCase      (   self   :		List[str]						)					->List[str]:




       """simple docstring"""


       a							=   Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''						)						) / '''000000039769.png'''						)
       a							=   self.tool(image=__SCREAMING_SNAKE_CASE				,      label='''cat'''						)
       self.assertTrue(isinstance(__SCREAMING_SNAKE_CASE				,      Image.Image						)						)







      def    __lowerCAmelCase      (   self   :		List[str]						)					->List[str]:




       """simple docstring"""


       a							=   Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''						)						) / '''000000039769.png'''						)
       a							=   self.remote_tool(image=__SCREAMING_SNAKE_CASE				,      label='''cat'''						)
       self.assertTrue(isinstance(__SCREAMING_SNAKE_CASE				,      Image.Image						)						)










from ...utils import is_transformers_available
from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline


if is_transformers_available():
     from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline


