
from ..utils import DummyObject, requires_backends
class    _UpperCamelCase(   metaclass=SCREAMING_SNAKE_CASE				):
						__A:						Optional[int]				   =      ["""torch""", """transformers""", """k_diffusion"""]

						def __init__(					self		:			List[Any]	,						*_lowerCamelCase		:			Any	,						**_lowerCamelCase		:			int			):
													requires_backends(self	,						["torch", "transformers", "k_diffusion"]			)

						@classmethod
						def 						a__ (					cls		:			Optional[int]	,						*_lowerCamelCase		:			Union[str, Any]	,						**_lowerCamelCase		:			List[Any]			):
													requires_backends(cls	,						["torch", "transformers", "k_diffusion"]			)






						@classmethod
						def 						a__ (					cls		:			Union[str, Any]	,						*_lowerCamelCase		:			Any	,						**_lowerCamelCase		:			List[Any]			):
													requires_backends(cls	,						["torch", "transformers", "k_diffusion"]			)






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		,						SCREAMING_SNAKE_CASE				):

						def 						a__ (					self		:			Optional[int]			):
													_UpperCAmelCase  :			Any	       =		load_tool("image-captioning"			)
													self.tool.setup()
													_UpperCAmelCase  :			Optional[Any]	       =		load_tool("image-captioning"	,						remote=_lowerCamelCase			)

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

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

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






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




