


"""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  lowerCamelCase__    (		_a     ):
      a			:  Tuple           =		"Salesforce/blip-image-captioning-base"
      a			:  List[str]           =		(
          "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			:  Optional[Any]           =		AutoModelForVisionaSeq

      a			:  Dict           =		["image"]
      a			:  Optional[int]           =		["text"]
      def __init__(		self						:						List[Any]   ,							*A_						:						int   ,							**A_						:						Optional[Any]				):






       '''simple docstring'''


       requires_backends(self   ,							["""vision"""]				)
       super().__init__(*A_   ,							**A_				)
      def SCREAMING_SNAKE_CASE_						(		self						:						List[str]   ,							A_						:						"Image"				):






       '''simple docstring'''


       return self.pre_processor(images=A_   ,							return_tensors="""pt"""				)
      def SCREAMING_SNAKE_CASE_						(		self						:						Tuple   ,							A_						:						Dict				):






       '''simple docstring'''


       return self.model.generate(**A_				)






      def SCREAMING_SNAKE_CASE_						(		self						:						Tuple   ,							A_						:						Optional[Any]				):






       '''simple docstring'''


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




'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__SCREAMING_SNAKE_CASE					:				List[str]									=		{
    '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GraphormerConfig'''],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__SCREAMING_SNAKE_CASE					:				Optional[Any]									=		[
							    '''GRAPHORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''GraphormerForGraphClassification''',
							    '''GraphormerModel''',
							    '''GraphormerPreTrainedModel''',
							]


if TYPE_CHECKING:
							from .configuration_graphormer import GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, GraphormerConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_graphormer import (
														    GRAPHORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
														    GraphormerForGraphClassification,
														    GraphormerModel,
														    GraphormerPreTrainedModel,
														)


else:
							import sys

							__SCREAMING_SNAKE_CASE					:				Optional[int]									=		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





