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






	def 			_a(self							:   Union[str, Any]						)   -> int:
							_lowercase					:  Union[str, Any]    			=      load_tool("image-captioning"						)
							self.tool.setup()
							_lowercase					:  int    			=      load_tool("image-captioning"			,  remote=snake_case						)






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






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






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






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






import os



def 		UpperCamelCase    (					)      -> Optional[int]:






						'''simple docstring'''

						_lowercase					:  Tuple    			=      0
						_lowercase					:  List[Any]    			=      0
						with open(os.path.dirname(_UpperCAmelCase     ) + "/p022_names.txt"     ) as file:
												_lowercase					:  Any    			=      str(file.readlines()[0]     )
												_lowercase					:  int    			=      name.replace("\""   , ""     ).split(","     )

						name.sort()
						for i in range(len(_UpperCAmelCase     )     ):
												for j in name[i]:
																		temp_sum += ord(_UpperCAmelCase     ) - ord("A"     ) + 1
												total_sum += (i + 1) * temp_sum
												_lowercase					:  Tuple    			=      0
						return total_sum


if __name__ == "__main__":
							print(solution())




