


'''simple docstring'''






from typing import List, Union

from ..utils import (
    add_end_docstrings,
    is_tf_available,
    is_torch_available,
    is_vision_available,
    logging,
    requires_backends,
)
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_vision_available():
 from PIL import Image

 from ..image_utils import load_image

if is_tf_available():
 import tensorflow as tf

 from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
 from ..tf_utils import stable_softmax

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

a_    :			Union[str, Any]      				=			logging.get_logger(__name__)




@add_end_docstrings(snake_case_				)
class        a   (   snake_case_				):
 def __init__(       self					, *__magic_name__					, **__magic_name__  )    ->							str:
      super().__init__(*__magic_name__					, **__magic_name__  )
      requires_backends(self					, 'vision'  )
      self.check_model_type(
          TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
          if self.framework == 'tf'
          else MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING  )
 def 							__UpperCAmelCase						(       self					, __magic_name__=None  )    ->							Tuple:
      _a						=							{}
      if top_k is not None:
           _a						=							top_k
      return {}, {}, postprocess_params
 def __call__(       self					, __magic_name__					, **__magic_name__  )    ->							Any:
      return super().__call__(__magic_name__					, **__magic_name__  )
 def 							__UpperCAmelCase						(       self					, __magic_name__  )    ->							int:
      _a						=							load_image(__magic_name__  )
      _a						=							self.image_processor(images=__magic_name__					, return_tensors=self.framework  )
      return model_inputs
 def 							__UpperCAmelCase						(       self					, __magic_name__  )    ->							Tuple:
      _a						=							self.model(**__magic_name__  )
      return model_outputs




 def 							__UpperCAmelCase						(       self					, __magic_name__					, __magic_name__=5  )    ->							List[Any]:
      if top_k > self.model.config.num_labels:
           _a						=							self.model.config.num_labels

      if self.framework == "pt":
           _a						=							model_outputs.logits.softmax(-1  )[0]
           _a					,      _a						=							probs.topk(__magic_name__  )
      elif self.framework == "tf":
           _a						=							stable_softmax(model_outputs.logits					, axis=-1  )[0]
           _a						=							tf.math.top_k(__magic_name__					, k=__magic_name__  )
           _a					,      _a						=							topk.values.numpy(), topk.indices.numpy()
      else:
           raise ValueError(f'Unsupported framework: {self.framework}'  )

      _a						=							scores.tolist()
      _a						=							ids.tolist()
      return [{"score": score, "label": self.model.config.idalabel[_id]} for score, _id in zip(__magic_name__					, __magic_name__  )]



__A				={str(digit): digit**5 for digit in range(1_0)}





def 			lowerCamelCase_ (				lowerCamelCase__    ):
				return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowerCamelCase__    )    )





def 			lowerCamelCase_ (				):
				return sum(
				    number
				    for number in range(1_0_0_0	, 1_0_0_0_0_0_0    )
				    if number == digits_fifth_powers_sum(lowerCamelCase__    )    )


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


