'''simple docstring'''





from io import BytesIO
from typing import List, Union

import requests

from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_decord_available():
 import numpy as np
 from decord import VideoReader


if is_torch_available():
 from ..models.auto.modeling_auto import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING

_lowerCAmelCase  :List[str]  				=    logging.get_logger(__name__)






@add_end_docstrings(_UpperCamelCase )
class 				UpperCAmelCase (       _UpperCamelCase ):




    '''simple docstring'''







    def __init__(       self    ,							*lowercase__    ,							**lowercase__ )							-> Dict:
         super().__init__(*lowercase__    ,							**lowercase__ )
         requires_backends(self    ,							'decord' )
         self.check_model_type(lowercase__ )






    def       _UpperCamelCase    (       self    ,							lowercase__=None    ,							lowercase__=None    ,							lowercase__=None )							-> Union[str, Any]:
         SCREAMING_SNAKE_CASE					:			Any    	=       {}
         if frame_sampling_rate is not None:
              SCREAMING_SNAKE_CASE					:			List[Any]    	=       frame_sampling_rate
         if num_frames is not None:
              SCREAMING_SNAKE_CASE					:			Tuple    	=       num_frames

         SCREAMING_SNAKE_CASE					:			Optional[Any]    	=       {}
         if top_k is not None:
              SCREAMING_SNAKE_CASE					:			str    	=       top_k
         return preprocess_params, {}, postprocess_params






    def __call__(       self    ,							lowercase__    ,							**lowercase__ )							-> Dict:
         return super().__call__(lowercase__    ,							**lowercase__ )






    def       _UpperCamelCase    (       self    ,							lowercase__    ,							lowercase__=None    ,							lowercase__=1 )							-> str:
         if num_frames is None:
              SCREAMING_SNAKE_CASE					:			Dict    	=       self.model.config.num_frames

         if video.startswith('http://' ) or video.startswith('https://' ):
              SCREAMING_SNAKE_CASE					:			Optional[int]    	=       BytesIO(requests.get(lowercase__ ).content )

         SCREAMING_SNAKE_CASE					:			List[str]    	=       VideoReader(lowercase__ )
         videoreader.seek(0 )

         SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       0
         SCREAMING_SNAKE_CASE					:			int    	=       num_frames * frame_sampling_rate - 1
         SCREAMING_SNAKE_CASE					:			Optional[int]    	=       np.linspace(lowercase__    ,							lowercase__    ,							num=lowercase__    ,							dtype=np.intaa )

         SCREAMING_SNAKE_CASE					:			str    	=       videoreader.get_batch(lowercase__ ).asnumpy()
         SCREAMING_SNAKE_CASE					:			Dict    	=       list(lowercase__ )

         SCREAMING_SNAKE_CASE					:			Optional[Any]    	=       self.image_processor(lowercase__    ,							return_tensors=self.framework )
         return model_inputs






    def       _UpperCamelCase    (       self    ,							lowercase__ )							-> str:
         SCREAMING_SNAKE_CASE					:			Any    	=       self.model(**lowercase__ )
         return model_outputs






    def       _UpperCamelCase    (       self    ,							lowercase__    ,							lowercase__=5 )							-> Tuple:
         if top_k > self.model.config.num_labels:
              SCREAMING_SNAKE_CASE					:			List[Any]    	=       self.model.config.num_labels

         if self.framework == "pt":
              SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       model_outputs.logits.softmax(-1 )[0]
              SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       probs.topk(lowercase__ )
         else:
              raise ValueError(F"""Unsupported framework: {self.framework}""" )

         SCREAMING_SNAKE_CASE					:			Tuple    	=       scores.tolist()
         SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       ids.tolist()
         return [{"score": score, "label": self.model.config.idalabel[_id]} for score, _id in zip(lowercase__    ,							lowercase__ )]

'''simple docstring'''





def     __lowerCAmelCase						(       a_ = 1000		)      ->	int:





     '''simple docstring'''





     SCREAMING_SNAKE_CASE					:			Union[str, Any]    	=       2**power
     SCREAMING_SNAKE_CASE					:			Any    	=       str(a_		)
     SCREAMING_SNAKE_CASE					:			int    	=       list(a_		)
     SCREAMING_SNAKE_CASE					:			Any    	=       0

     for i in list_num:
          sum_of_num += int(a_		)

     return sum_of_num


if __name__ == "__main__":
 _lowerCAmelCase  :Tuple  				=    int(input("""Enter the power of 2: """).strip())
 print("""2 ^ """, power, """ = """, 2**power)
 _lowerCAmelCase  :int  				=    solution(power)
 print("""Sum of the digits is: """, result)



