

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

   '''simple docstring'''




   def 					_UpperCAmelCase					(							self			)				->       Tuple:






     """simple docstring"""






     a__    =load_tool('''image-captioning'''			)
     self.tool.setup()
     a__    =load_tool('''image-captioning''',       remote=lowercase_			)



   def 					_UpperCAmelCase					(							self			)				->       int:






     """simple docstring"""






     a__    =Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''			)			) / '''000000039769.png'''			)
     a__    =self.tool(lowercase_			)
     self.assertEqual(lowercase_,       '''two cats sleeping on a couch'''			)



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






     """simple docstring"""






     a__    =Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''			)			) / '''000000039769.png'''			)
     a__    =self.remote_tool(lowercase_			)
     self.assertEqual(lowercase_,       '''two cats sleeping on a couch'''			)



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






     """simple docstring"""






     a__    =Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''			)			) / '''000000039769.png'''			)
     a__    =self.tool(image=lowercase_			)
     self.assertEqual(lowercase_,       '''two cats sleeping on a couch'''			)



   def 					_UpperCAmelCase					(							self			)				->       str:






     """simple docstring"""






     a__    =Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''			)			) / '''000000039769.png'''			)
     a__    =self.remote_tool(image=lowercase_			)
     self.assertEqual(lowercase_,       '''two cats sleeping on a couch'''			)



def      UpperCAmelCase__							(     _A :					int      , _A :					int				):





  '''simple docstring'''







  a__    =1.0
  for i in range(1      , r + 1				):
    ret *= (n + 1 - i) / i
  return round(_A				)




def      UpperCAmelCase__							(     _A :					int				):





  '''simple docstring'''







  return choose(8 + n      , _A				) + choose(9 + n      , _A				) - 10




def      UpperCAmelCase__							(     _A :					int				):





  '''simple docstring'''







  return sum(non_bouncy_exact(_A				) for i in range(1      , n + 1				)				)




def      UpperCAmelCase__							(     _A :					int = 1_00				):





  '''simple docstring'''







  return non_bouncy_upto(_A				)


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