
"""simple docstring"""


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





			'''simple docstring'''



			def    _lowerCAmelCase						(				self    )					->	Optional[int]:
				_lowerCAmelCase								=load_tool("""image-captioning"""    )
				self.tool.setup()
				_lowerCAmelCase								=load_tool("""image-captioning"""	,	remote=__UpperCAmelCase    )



			def    _lowerCAmelCase						(				self    )					->	Union[str, Any]:
				_lowerCAmelCase								=Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""    )    ) / """000000039769.png"""    )
				_lowerCAmelCase								=self.tool(__UpperCAmelCase    )
				self.assertEqual(__UpperCAmelCase	,	"""two cats sleeping on a couch"""    )



			def    _lowerCAmelCase						(				self    )					->	Optional[Any]:
				_lowerCAmelCase								=Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""    )    ) / """000000039769.png"""    )
				_lowerCAmelCase								=self.remote_tool(__UpperCAmelCase    )
				self.assertEqual(__UpperCAmelCase	,	"""two cats sleeping on a couch"""    )



			def    _lowerCAmelCase						(				self    )					->	Union[str, Any]:
				_lowerCAmelCase								=Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""    )    ) / """000000039769.png"""    )
				_lowerCAmelCase								=self.tool(image=__UpperCAmelCase    )
				self.assertEqual(__UpperCAmelCase	,	"""two cats sleeping on a couch"""    )



			def    _lowerCAmelCase						(				self    )					->	List[Any]:
				_lowerCAmelCase								=Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""    )    ) / """000000039769.png"""    )
				_lowerCAmelCase								=self.remote_tool(image=__UpperCAmelCase    )
				self.assertEqual(__UpperCAmelCase	,	"""two cats sleeping on a couch"""    )





"""simple docstring"""


import warnings

from .generation import FlaxGenerationMixin







class 						lowerCamelCase__   (   __magic_name__							):





			'''simple docstring'''
			# warning at import time
			warnings.warn(
			    '''Importing `FlaxGenerationMixin` from `src/transformers/generation_flax_utils.py` is deprecated and will '''
			    '''be removed in Transformers v5. Import as `from transformers import FlaxGenerationMixin` instead.'''					,      __magic_name__					,      )



