





'''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				(		lowerCAmelCase_  ):
		a  :  str      ='Salesforce/blip-image-captioning-base'
		a  :  Union[str, 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.'
		)
		a  :  List[Any]      ='image_captioner'
		a  :  Union[str, Any]      =AutoModelForVisionaSeq

		a  :  Dict      =['image']
		a  :  Optional[int]      =['text']
		def __init__(    self,*__SCREAMING_SNAKE_CASE,**__SCREAMING_SNAKE_CASE     ):



					'''simple docstring'''

					requires_backends(self,["""vision"""]     )
					super().__init__(*lowerCAmelCase__,**lowerCAmelCase__     )
		def     lowerCamelCase__     (    self,__SCREAMING_SNAKE_CASE     ):



					'''simple docstring'''

					return self.pre_processor(images=lowerCAmelCase__,return_tensors="""pt"""     )
		def     lowerCamelCase__     (    self,__SCREAMING_SNAKE_CASE     ):



					'''simple docstring'''

					return self.model.generate(**lowerCAmelCase__     )







		def     lowerCamelCase__     (    self,__SCREAMING_SNAKE_CASE     ):



					'''simple docstring'''

					return self.pre_processor.batch_decode(lowerCAmelCase__,skip_special_tokens=lowerCAmelCase__     )[0].strip()








'''simple docstring'''

def    a__							(							lowercase   :	str )						->						int:





     """simple docstring"""

     assert column_title.isupper()
     _UpperCamelCase							       =			0
     _UpperCamelCase							       =			len(lowercase ) - 1
     _UpperCamelCase							       =			0

     while index >= 0:
          _UpperCamelCase							       =			(ord(column_title[index] ) - 64) * pow(26,   lowercase )
          answer += value
          power += 1
          index -= 1

     return answer


if __name__ == "__main__":
   from doctest import testmod

   testmod()



