
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_   (			a__   ):




	'''simple docstring'''


	_UpperCamelCase     :     Union[str, Any]							 =       """Salesforce/blip-image-captioning-base"""
	_UpperCamelCase     :     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."""
	)
	_UpperCamelCase     :     Optional[Any]							 =       """image_captioner"""
	_UpperCamelCase     :     Union[str, Any]							 =       AutoModelForVisionaSeq

	_UpperCamelCase     :     List[str]							 =       ["""image"""]
	_UpperCamelCase     :     int							 =       ["""text"""]





	def __init__(       self		,    *snake_case		,    **snake_case       ):
		requires_backends(self		,    ['vision']       )
		super().__init__(*UpperCamelCase_		,    **UpperCamelCase_       )





	def 	SCREAMING_SNAKE_CASE__						(       self		,    snake_case       ):
		return self.pre_processor(images=UpperCamelCase_		,    return_tensors='pt'       )





	def 	SCREAMING_SNAKE_CASE__						(       self		,    snake_case       ):
		return self.model.generate(**UpperCamelCase_       )





	def 	SCREAMING_SNAKE_CASE__						(       self		,    snake_case       ):
		return self.pre_processor.batch_decode(UpperCamelCase_		,    skip_special_tokens=UpperCamelCase_       )[0].strip()





"""simple docstring"""





import numpy as np


def    _snake_case  (  _snake_case :	np.array	):
      return 1 / (1 + np.exp(-vector	))


if __name__ == "__main__":
 import doctest

 doctest.testmod()


