






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






 '''simple docstring'''




 def        snake_case__ (		self)       ->						Any:

     """simple docstring"""



     _UpperCAmelCase :					str	     = load_tool('''image-captioning''')
     self.tool.setup()
     _UpperCAmelCase :					Union[str, Any]	     = load_tool('''image-captioning'''							,     remote=_A)


 def        snake_case__ (		self)       ->						List[str]:

     """simple docstring"""



     _UpperCAmelCase :					Any	     = Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO''')) / '''000000039769.png''')
     _UpperCAmelCase :					List[Any]	     = self.tool(_A)
     self.assertEqual(_A							,     '''two cats sleeping on a couch''')


 def        snake_case__ (		self)       ->						List[str]:

     """simple docstring"""



     _UpperCAmelCase :					Any	     = Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO''')) / '''000000039769.png''')
     _UpperCAmelCase :					List[Any]	     = self.remote_tool(_A)
     self.assertEqual(_A							,     '''two cats sleeping on a couch''')


 def        snake_case__ (		self)       ->						List[str]:

     """simple docstring"""



     _UpperCAmelCase :					List[Any]	     = Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO''')) / '''000000039769.png''')
     _UpperCAmelCase :					int	     = self.tool(image=_A)
     self.assertEqual(_A							,     '''two cats sleeping on a couch''')


 def        snake_case__ (		self)       ->						Any:

     """simple docstring"""



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








'''simple docstring'''







import sys

sys.set_int_max_str_digits(0)  # type: ignore






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Optional[Any]      =					[0] * 11
       _A     :	str      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	int      =					1
              _A     :	Optional[int]      =					number // 10
       # flag
       _A     :	List[Any]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	Optional[int]      =					False
       if not f:
              return f

       # mark first 9 numbers
       _A     :	Optional[int]      =					int(str(lowerCamelCase   )[:9]   )

       for _ in range(9   ):
              _A     :	Optional[Any]      =					1
              _A     :	str      =					number // 10

       # check first 9 numbers for pandigitality

       for x in range(9   ):
              if not check_front[x + 1]:
                     _A     :	Optional[Any]      =					False
       return f






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Dict      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	List[str]      =					1
              _A     :	Dict      =					number // 10
       # flag
       _A     :	Optional[int]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	List[str]      =					False
       return f






def       lowerCAmelCase__       (				):
       _A     :	List[Any]      =					1
       _A     :	Dict      =					1
       _A     :	Dict      =					2
       # temporary Fibonacci numbers

       _A     :	List[Any]      =					1
       _A     :	Union[str, Any]      =					1
       _A     :	List[Any]      =					2
       # temporary Fibonacci numbers mod 1e9

       # mod m=1e9, done for fast optimisation
       _A     :	Tuple      =					[0] * 1000000
       _A     :	Any      =					1000000000

       for x in range(1000000   ):
              _A     :	Tuple      =					(aa + ba) % m
              _A     :	Optional[Any]      =					ba % m
              _A     :	str      =					ca % m
              if checka(lowerCamelCase   ):
                     _A     :	Dict      =					1

       for x in range(1000000   ):
              _A     :	List[str]      =					a + b
              _A     :	Optional[int]      =					b
              _A     :	str      =					c
              # perform check only if in tocheck
              if tocheck[x + 3] and check(lowerCamelCase   ):
                     return x + 3  # first 2 already done
       return -1


if __name__ == "__main__":
   print(f"""{solution() = }""")






