


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




	def  SCREAMING_SNAKE_CASE__       (	self					):
							a		:Optional[Any]											= load_tool('''image-captioning'''					)
							self.tool.setup()
							a		:str											= load_tool('''image-captioning'''      ,						remote=_lowerCamelCase					)




	def  SCREAMING_SNAKE_CASE__       (	self					):
							a		:Optional[int]											= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''					)					) / '''000000039769.png'''					)
							a		:Tuple											= self.tool(_lowerCamelCase					)
							self.assertEqual(_lowerCamelCase      ,						'''two cats sleeping on a couch'''					)




	def  SCREAMING_SNAKE_CASE__       (	self					):
							a		:str											= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''					)					) / '''000000039769.png'''					)
							a		:Optional[int]											= self.remote_tool(_lowerCamelCase					)
							self.assertEqual(_lowerCamelCase      ,						'''two cats sleeping on a couch'''					)




	def  SCREAMING_SNAKE_CASE__       (	self					):
							a		:Union[str, Any]											= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''					)					) / '''000000039769.png'''					)
							a		:Tuple											= self.tool(image=_lowerCamelCase					)
							self.assertEqual(_lowerCamelCase      ,						'''two cats sleeping on a couch'''					)




	def  SCREAMING_SNAKE_CASE__       (	self					):
							a		:str											= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''					)					) / '''000000039769.png'''					)
							a		:Any											= self.remote_tool(image=_lowerCamelCase					)
							self.assertEqual(_lowerCamelCase      ,						'''two cats sleeping on a couch'''					)









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


snake_case       :					Dict        =  {
    '''configuration_align''': [
        '''ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AlignConfig''',
        '''AlignTextConfig''',
        '''AlignVisionConfig''',
    ],
    '''processing_align''': ['''AlignProcessor'''],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     snake_case       :					List[str]        =  [
         '''ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''AlignModel''',
         '''AlignPreTrainedModel''',
         '''AlignTextModel''',
         '''AlignVisionModel''',
     ]

if TYPE_CHECKING:
     from .configuration_align import (
         ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
         AlignConfig,
         AlignTextConfig,
         AlignVisionConfig,
     )
     from .processing_align import AlignProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_align import (
              ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
              AlignModel,
              AlignPreTrainedModel,
              AlignTextModel,
              AlignVisionModel,
          )

else:
     import sys

     snake_case       :					int        =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





