






"""simple docstring"""





_SCREAMING_SNAKE_CASE					:				Tuple					    =						[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
_SCREAMING_SNAKE_CASE					:				int					    =						[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
_SCREAMING_SNAKE_CASE					:				str					    =						{
    0: '''Sunday''',
    1: '''Monday''',
    2: '''Tuesday''',
    3: '''Wednesday''',
    4: '''Thursday''',
    5: '''Friday''',
    6: '''Saturday''',
}







def      lowerCamelCase__       (							_lowerCamelCase       :		int		,				_lowerCamelCase       :		int		,				_lowerCamelCase       :		int )      ->				str:
  assert len(str(_lowerCamelCase ) ) > 2, "year should be in YYYY format"
  assert 1 <= month <= 12, "month should be between 1 to 12"
  assert 1 <= day <= 31, "day should be between 1 to 31"

  # Doomsday algorithm:
  lowerCamelCase_         =						year // 100
  lowerCamelCase_         =						(5 * (century % 4) + 2) % 7
  lowerCamelCase_         =						year % 100
  lowerCamelCase_         =						centurian % 12
  lowerCamelCase_         =						(
      (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
  ) % 7
  lowerCamelCase_         =						(
      DOOMSDAY_NOT_LEAP[month - 1]
      if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
      else DOOMSDAY_LEAP[month - 1]
  )
  lowerCamelCase_         =						(dooms_day + day - day_anchor) % 7
  return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
  import doctest

  doctest.testmod()












"""simple docstring"""





# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ..models.auto import AutoModelForVisionaSeq
from ..utils import requires_backends
from .base import PipelineTool


if TYPE_CHECKING:
  from PIL import Image






class      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     Dict						= """Salesforce/blip-image-captioning-base"""
    SCREAMING_SNAKE_CASE						:     int						= (
        """This is a tool that generates a description of an image. It takes an input named `image` which should be the """
        """image to caption, and returns a text that contains the description in English."""
    )
    SCREAMING_SNAKE_CASE						:     Optional[int]						= """image_captioner"""
    SCREAMING_SNAKE_CASE						:     Optional[Any]						= AutoModelForVisionaSeq

    SCREAMING_SNAKE_CASE						:     int						= ["""image"""]
    SCREAMING_SNAKE_CASE						:     Optional[Any]						= ["""text"""]






    def __init__(       self     :							Optional[Any]       ,						*__SCREAMING_SNAKE_CASE     :							Optional[Any]       ,						**__SCREAMING_SNAKE_CASE     :							List[Any]					)     ->		Optional[Any]:
      requires_backends(self       ,						['vision']					)
      super().__init__(*__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							List[Any]       ,						__SCREAMING_SNAKE_CASE     :							"Image"					)     ->		Dict:
      return self.pre_processor(images=__SCREAMING_SNAKE_CASE       ,						return_tensors='pt'					)






    def    UpperCamelCase       (       self     :							List[str]       ,						__SCREAMING_SNAKE_CASE     :							Tuple					)     ->		str:
      return self.model.generate(**__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							Union[str, Any]       ,						__SCREAMING_SNAKE_CASE     :							List[str]					)     ->		Optional[Any]:
      return self.pre_processor.batch_decode(__SCREAMING_SNAKE_CASE       ,						skip_special_tokens=__SCREAMING_SNAKE_CASE					)[0].strip()




