

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__(__snake_case				):
						"""simple docstring"""






						_A  :							List[Any]     =       '''Salesforce/blip-image-captioning-base'''
						_A  :							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  :							Dict     =       '''image_captioner'''
						_A  :							Tuple     =       AutoModelForVisionaSeq

						_A  :							Tuple     =       ['''image''']
						_A  :							Optional[int]     =       ['''text''']





						def __init__(  self   ,	*_lowercase   ,	**_lowercase  )			->      List[str]:
									requires_backends(self   ,	["""vision"""]  )
									super().__init__(*_lowercase   ,	**_lowercase  )





						def        UpperCamelCase__ (  self   ,	_lowercase  )			->      Optional[Any]:
									return self.pre_processor(images=_lowercase   ,	return_tensors="""pt"""  )





						def        UpperCamelCase__ (  self   ,	_lowercase  )			->      Optional[int]:
									return self.model.generate(**_lowercase  )





						def        UpperCamelCase__ (  self   ,	_lowercase  )			->      str:
									return self.pre_processor.batch_decode(_lowercase   ,	skip_special_tokens=_lowercase  )[0].strip()




'''simple docstring'''




from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL

from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
from .timesteps import (
    fastaa_timesteps,
    smartaa_timesteps,
    smartaa_timesteps,
    smartaaa_timesteps,
    smartaaa_timesteps,
    superaa_timesteps,
    superaa_timesteps,
    superaaa_timesteps,
)





@dataclass
class  A				(							__snake_case						):
     __magic_name__						=		42
     __magic_name__						=		42
     __magic_name__						=		42


try:
      if not (is_transformers_available() and is_torch_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
      from .pipeline_if import IFPipeline
      from .pipeline_if_imgaimg import IFImgaImgPipeline
      from .pipeline_if_imgaimg_superresolution import IFImgaImgSuperResolutionPipeline
      from .pipeline_if_inpainting import IFInpaintingPipeline
      from .pipeline_if_inpainting_superresolution import IFInpaintingSuperResolutionPipeline
      from .pipeline_if_superresolution import IFSuperResolutionPipeline
      from .safety_checker import IFSafetyChecker
      from .watermark import IFWatermarker




