


'''simple docstring'''





import unittest

from transformers import (
    MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
    TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
    PreTrainedTokenizer,
    is_vision_available,
)
from transformers.pipelines import ImageClassificationPipeline, pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_torch_or_tf,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
    from PIL import Image
else:




    class 							UpperCAmelCase :


     @staticmethod
     def 					__SCREAMING_SNAKE_CASE				(			*__lowerCamelCase       :  Dict ,					**__lowerCamelCase       :  Dict   ):
        pass




@is_pipeline_test
@require_torch_or_tf
@require_vision
class 							UpperCAmelCase ( unittest.TestCase	):
 UpperCAmelCase				=				MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
 UpperCAmelCase				=				TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING


 def 					__SCREAMING_SNAKE_CASE				(			self       :  Tuple ,					__lowerCamelCase       :  List[str] ,					__lowerCamelCase       :  List[str] ,					__lowerCamelCase       :  int   ):
    UpperCAmelCase__  :Union[str, Any]            =			ImageClassificationPipeline(model=__lowerCamelCase ,					image_processor=__lowerCamelCase ,					top_k=2   )
    UpperCAmelCase__  :Union[str, Any]            =			[
        Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''   ),
        '''http://images.cocodataset.org/val2017/000000039769.jpg''',
    ]
    return image_classifier, examples


 def 					__SCREAMING_SNAKE_CASE				(			self       :  str ,					__lowerCamelCase       :  List[str] ,					__lowerCamelCase       :  str   ):
    UpperCAmelCase__  :Tuple            =			image_classifier('''./tests/fixtures/tests_samples/COCO/000000039769.png'''   )

    self.assertEqual(
        __lowerCamelCase ,					[
            {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
        ] ,					)

    import datasets

    UpperCAmelCase__  :List[str]            =			datasets.load_dataset('''hf-internal-testing/fixtures_image_utils''' ,					'''image''' ,					split='''test'''   )

    # Accepts URL + PIL.Image + lists
    UpperCAmelCase__  :Any            =			image_classifier(
        [
            Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''   ),
            '''http://images.cocodataset.org/val2017/000000039769.jpg''',
            # RGBA
            dataset[0]['''file'''],
            # LA
            dataset[1]['''file'''],
            # L
            dataset[2]['''file'''],
        ]   )
    self.assertEqual(
        __lowerCamelCase ,					[
            [
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            ],
            [
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            ],
            [
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            ],
            [
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            ],
            [
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
                {'''score''': ANY(__lowerCamelCase   ), '''label''': ANY(__lowerCamelCase   )},
            ],
        ] ,					)


 @require_torch
 def 					__SCREAMING_SNAKE_CASE				(			self       :  Tuple   ):
    UpperCAmelCase__  :Union[str, Any]            =			'''hf-internal-testing/tiny-random-vit'''
    UpperCAmelCase__  :str            =			pipeline('''image-classification''' ,					model=__lowerCamelCase   )

    UpperCAmelCase__  :Union[str, Any]            =			image_classifier('''http://images.cocodataset.org/val2017/000000039769.jpg'''   )
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}] ,					)

    UpperCAmelCase__  :Optional[Any]            =			image_classifier(
        [
            '''http://images.cocodataset.org/val2017/000000039769.jpg''',
            '''http://images.cocodataset.org/val2017/000000039769.jpg''',
        ] ,					top_k=2 ,					)
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[
            [{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}],
            [{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}],
        ] ,					)


 @require_tf
 def 					__SCREAMING_SNAKE_CASE				(			self       :  Optional[int]   ):
    UpperCAmelCase__  :Optional[Any]            =			'''hf-internal-testing/tiny-random-vit'''
    UpperCAmelCase__  :Optional[int]            =			pipeline('''image-classification''' ,					model=__lowerCamelCase ,					framework='''tf'''   )

    UpperCAmelCase__  :Tuple            =			image_classifier('''http://images.cocodataset.org/val2017/000000039769.jpg'''   )
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}] ,					)

    UpperCAmelCase__  :Optional[Any]            =			image_classifier(
        [
            '''http://images.cocodataset.org/val2017/000000039769.jpg''',
            '''http://images.cocodataset.org/val2017/000000039769.jpg''',
        ] ,					top_k=2 ,					)
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[
            [{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}],
            [{'''label''': '''LABEL_1''', '''score''': 0.5_74}, {'''label''': '''LABEL_0''', '''score''': 0.4_26}],
        ] ,					)


 def 					__SCREAMING_SNAKE_CASE				(			self       :  int   ):
    UpperCAmelCase__  :Optional[int]            =			PreTrainedTokenizer()

    # Assert that the pipeline can be initialized with a feature extractor that is not in any mapping
    UpperCAmelCase__  :int            =			pipeline(
        '''image-classification''' ,					model='''hf-internal-testing/tiny-random-vit''' ,					tokenizer=__lowerCamelCase   )

    self.assertIs(image_classifier.tokenizer ,					__lowerCamelCase   )





 @slow
 @require_torch
 def 					__SCREAMING_SNAKE_CASE				(			self       :  Dict   ):
    # Perceiver is not tested by `run_pipeline_test` properly.
    # That is because the type of feature_extractor and model preprocessor need to be kept
    # in sync, which is not the case in the current design
    UpperCAmelCase__  :Optional[int]            =			pipeline('''image-classification''' ,					model='''deepmind/vision-perceiver-conv'''   )
    UpperCAmelCase__  :Dict            =			image_classifier('''http://images.cocodataset.org/val2017/000000039769.jpg'''   )
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[
            {'''score''': 0.43_85, '''label''': '''tabby, tabby cat'''},
            {'''score''': 0.3_21, '''label''': '''tiger cat'''},
            {'''score''': 0.05_02, '''label''': '''Egyptian cat'''},
            {'''score''': 0.01_37, '''label''': '''crib, cot'''},
            {'''score''': 0.0_07, '''label''': '''radiator'''},
        ] ,					)

    UpperCAmelCase__  :str            =			pipeline('''image-classification''' ,					model='''deepmind/vision-perceiver-fourier'''   )
    UpperCAmelCase__  :List[str]            =			image_classifier('''http://images.cocodataset.org/val2017/000000039769.jpg'''   )
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[
            {'''score''': 0.56_58, '''label''': '''tabby, tabby cat'''},
            {'''score''': 0.13_09, '''label''': '''tiger cat'''},
            {'''score''': 0.07_22, '''label''': '''Egyptian cat'''},
            {'''score''': 0.07_07, '''label''': '''remote control, remote'''},
            {'''score''': 0.00_82, '''label''': '''computer keyboard, keypad'''},
        ] ,					)

    UpperCAmelCase__  :List[str]            =			pipeline('''image-classification''' ,					model='''deepmind/vision-perceiver-learned'''   )
    UpperCAmelCase__  :List[Any]            =			image_classifier('''http://images.cocodataset.org/val2017/000000039769.jpg'''   )
    self.assertEqual(
        nested_simplify(__lowerCamelCase ,					decimals=4   ) ,					[
            {'''score''': 0.30_22, '''label''': '''tabby, tabby cat'''},
            {'''score''': 0.23_62, '''label''': '''Egyptian cat'''},
            {'''score''': 0.18_56, '''label''': '''tiger cat'''},
            {'''score''': 0.03_24, '''label''': '''remote control, remote'''},
            {'''score''': 0.00_96, '''label''': '''quilt, comforter, comfort, puff'''},
        ] ,					)







'''simple docstring'''





def 					a__    (				UpperCamelCase_	:			int = 100	):
   UpperCAmelCase__  :List[str]            =			1
   UpperCAmelCase__  :Dict            =			0
   for i in range(1,      num + 1	):
      fact *= i

   for j in str(UpperCamelCase_	):
      result += int(UpperCamelCase_	)

   return result


if __name__ == "__main__":
    print(solution(int(input('''Enter the Number: ''').strip())))



