
"""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 		UpperCAmelCase_	(unittest.TestCase  , lowerCamelCase_						):
	"""simple docstring"""




	def   a      ( self       : Union[str, Any] )->					str:



						"""simple docstring"""

						UpperCAmelCase_						:    Any    					=  load_tool("""image-captioning""" )
						self.tool.setup()
						UpperCAmelCase_						:    Tuple    					=  load_tool("""image-captioning"""     ,   remote=a_ )




	def   a      ( self       : Dict )->					Union[str, Any]:



						"""simple docstring"""

						UpperCAmelCase_						:    Dict    					=  Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO""" ) ) / """000000039769.png""" )
						UpperCAmelCase_						:    List[str]    					=  self.tool(a_ )
						self.assertEqual(a_     ,   """two cats sleeping on a couch""" )




	def   a      ( self       : Optional[int] )->					Dict:



						"""simple docstring"""

						UpperCAmelCase_						:    int    					=  Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO""" ) ) / """000000039769.png""" )
						UpperCAmelCase_						:    int    					=  self.remote_tool(a_ )
						self.assertEqual(a_     ,   """two cats sleeping on a couch""" )




	def   a      ( self       : Dict )->					int:



						"""simple docstring"""

						UpperCAmelCase_						:    Any    					=  Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO""" ) ) / """000000039769.png""" )
						UpperCAmelCase_						:    Any    					=  self.tool(image=a_ )
						self.assertEqual(a_     ,   """two cats sleeping on a couch""" )






	def   a      ( self       : Dict )->					Tuple:



						"""simple docstring"""

						UpperCAmelCase_						:    Optional[Any]    					=  Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO""" ) ) / """000000039769.png""" )
						UpperCAmelCase_						:    List[str]    					=  self.remote_tool(image=a_ )
						self.assertEqual(a_     ,   """two cats sleeping on a couch""" )



"""simple docstring"""







import warnings

from .generation import GenerationMixin



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 warnings.warn(
     """Importing `GenerationMixin` from `src/transformers/generation_utils.py` is deprecated and will """
     """be removed in Transformers v5. Import as `from transformers import GenerationMixin` instead."""  , lowerCamelCase_  , )

