


'''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 	a       (       _SCREAMING_SNAKE_CASE    ):
 _lowerCAmelCase	   =		"""Salesforce/blip-image-captioning-base"""
 _lowerCAmelCase	   =		(
     """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."""
 )
 _lowerCAmelCase	   =		"""image_captioner"""
 _lowerCAmelCase	   =		AutoModelForVisionaSeq

 _lowerCAmelCase	   =		["""image"""]
 _lowerCAmelCase	   =		["""text"""]
 def __init__(	self ,			*__magic_name__ ,			**__magic_name__  )   ->							Optional[Any]:
      requires_backends(self ,			['vision']  )
      super().__init__(*__magic_name__ ,			**__magic_name__  )
 def 							__UpperCAmelCase						(	self ,			__magic_name__  )   ->							List[str]:
      return self.pre_processor(images=__magic_name__ ,			return_tensors='pt'  )
 def 							__UpperCAmelCase						(	self ,			__magic_name__  )   ->							Optional[Any]:
      return self.model.generate(**__magic_name__  )




 def 							__UpperCAmelCase						(	self ,			__magic_name__  )   ->							Optional[int]:
      return self.pre_processor.batch_decode(__magic_name__ ,			skip_special_tokens=__magic_name__  )[0].strip()





'''simple docstring'''






def 		_A			(lowerCAmelCase__					:int						)				->					int:




     '''simple docstring'''



     assert (
         isinstance(lowerCAmelCase__			,  lowerCAmelCase__						) and number_of_steps > 0
     ), f'number_of_steps needs to be positive integer, your input {number_of_steps}'
     if number_of_steps == 1:
          return 1
     _a ,				_a      =							1, 1
     for _ in range(number_of_steps - 1						):
          _a ,				_a      =							current + previous, current
     return current


if __name__ == "__main__":
 import doctest

 doctest.testmod()

