
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

lowerCamelCase__    :		Tuple          =   logging.get_logger(__name__)



@add_end_docstrings(UpperCAmelCase_							)
class       _snake_case   (	UpperCAmelCase_							):


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   super().__init__(*SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_)
   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      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_=None):


   '''simple docstring'''




   lowercase__  :   Optional[Any]    		=      {}
   if top_k is not None:
     lowercase__  :   List[Any]    		=      top_k
   return {}, {}, postprocess_params


 def __call__(					self					,  SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   return super().__call__(SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_)


 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   lowercase__  :   Optional[Any]    		=      load_image(SCREAMING_SNAKE_CASE_)
   lowercase__  :   Dict    		=      self.image_processor(images=SCREAMING_SNAKE_CASE_					,  return_tensors=self.framework)
   return model_inputs


 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   lowercase__  :   Union[str, Any]    		=      self.model(**SCREAMING_SNAKE_CASE_)
   return model_outputs



 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_=5):


   '''simple docstring'''




   if top_k > self.model.config.num_labels:
     lowercase__  :   List[str]    		=      self.model.config.num_labels

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

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








import sys

lowerCamelCase__    :		List[Any]          =   (
    """73167176531330624919225119674426574742355349194934"""
    """96983520312774506326239578318016984801869478851843"""
    """85861560789112949495459501737958331952853208805511"""
    """12540698747158523863050715693290963295227443043557"""
    """66896648950445244523161731856403098711121722383113"""
    """62229893423380308135336276614282806444486645238749"""
    """30358907296290491560440772390713810515859307960866"""
    """70172427121883998797908792274921901699720888093776"""
    """65727333001053367881220235421809751254540594752243"""
    """52584907711670556013604839586446706324415722155397"""
    """53697817977846174064955149290862569321978468622482"""
    """83972241375657056057490261407972968652414535100474"""
    """82166370484403199890008895243450658541227588666881"""
    """16427171479924442928230863465674813919123162824586"""
    """17866458359124566529476545682848912883142607690042"""
    """24219022671055626321111109370544217506941658960408"""
    """07198403850962455444362981230987879927244284909188"""
    """84580156166097919133875499200524063689912560717606"""
    """05886116467109405077541002256983155200055935729725"""
    """71636269561882670428252483600823257530420752963450"""
)

def 		UpperCamelCase	(      lowercase_ = N   )		->	int:


  '''simple docstring'''






  lowercase__  :   int    		=      -sys.maxsize - 1
  for i in range(len(lowercase_   ) - 12   ):
    lowercase__  :   Optional[int]    		=      1
    for j in range(13   ):
      product *= int(n[i + j]   )
    if product > largest_product:
      lowercase__  :   int    		=      product
  return largest_product


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






