
"""simple docstring"""
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      _UpperCAmelCase				(					_snake_case):
    __lowercase							: Dict  =					"""Salesforce/blip-image-captioning-base"""
    __lowercase							: Optional[Any]  =					(
        """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."""
    )
    __lowercase							: Dict  =					"""image_captioner"""
    __lowercase							: int  =					AutoModelForVisionaSeq

    __lowercase							: Any  =					["""image"""]
    __lowercase							: int  =					["""text"""]
    def __init__(    self						,    *snake_case_						,    **snake_case_     ):
      requires_backends(self						,    ["vision"]     )
      super().__init__(*__UpperCamelCase						,    **__UpperCamelCase     )
    def 					lowerCamelCase__	(    self						,    snake_case_     ):
      return self.pre_processor(images=__UpperCamelCase						,    return_tensors="pt"     )
    def 					lowerCamelCase__	(    self						,    snake_case_     ):
      return self.model.generate(**__UpperCamelCase     )


    def 					lowerCamelCase__	(    self						,    snake_case_     ):
      return self.pre_processor.batch_decode(__UpperCamelCase						,    skip_special_tokens=__UpperCamelCase     )[0].strip()



"""simple docstring"""
def 				a__   (   a   :				int		):

  """simple docstring"""







  if not isinstance(a       ,     a		):
    raise TypeError("Input value must be an 'int' type"		)

  _snake_case     :						Union[str, Any]						=   0
  while number:
    position += 1
    number >>= 1

  return position


if __name__ == "__main__":
    import doctest

    doctest.testmod()

