




"""simple docstring"""

from typing import List, Union

import numpy as np

from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_vision_available():
       from PIL import Image

       from ..image_utils import load_image

if is_torch_available():
       import torch

       from ..models.auto.modeling_auto import MODEL_FOR_DEPTH_ESTIMATION_MAPPING

a							      =     logging.get_logger(__name__)





@add_end_docstrings(__lowerCAmelCase				)
class 							lowercase_			(	__lowerCAmelCase				):



 '''simple docstring'''

 def __init__(					self			:			Dict       ,				*_UpperCAmelCase			:			List[Any]       ,				**_UpperCAmelCase			:			List[str]						):
       super().__init__(*_UpperCAmelCase       ,				**_UpperCAmelCase						)
       requires_backends(self       ,				'vision'						)
       self.check_model_type(_UpperCAmelCase						)

 def __call__(					self			:			Union[str, Any]       ,				_UpperCAmelCase			:			Union[str, List[str], "Image.Image", List["Image.Image"]]       ,				**_UpperCAmelCase			:			int						):
       return super().__call__(_UpperCAmelCase       ,				**_UpperCAmelCase						)

 def      lowerCAmelCase_				(					self			:			Optional[Any]       ,				**_UpperCAmelCase			:			List[str]						):
       return {}, {}, {}

 def      lowerCAmelCase_				(					self			:			Optional[Any]       ,				_UpperCAmelCase			:			List[Any]						):
       _A     =  load_image(_UpperCAmelCase						)
       _A     =  image.size
       _A     =  self.image_processor(images=_UpperCAmelCase       ,				return_tensors=self.framework						)
       return model_inputs

 def      lowerCAmelCase_				(					self			:			int       ,				_UpperCAmelCase			:			Optional[Any]						):
       _A     =  self.model(**_UpperCAmelCase						)
       return model_outputs



 def      lowerCAmelCase_				(					self			:			int       ,				_UpperCAmelCase			:			Optional[int]						):
       _A     =  model_outputs.predicted_depth
       _A     =  torch.nn.functional.interpolate(
           predicted_depth.unsqueeze(1						)       ,				size=self.image_size[::-1]       ,				mode='bicubic'       ,				align_corners=_UpperCAmelCase						)
       _A     =  prediction.squeeze().cpu().numpy()
       _A     =  (output * 255 / np.max(_UpperCAmelCase						)).astype('uint8'						)
       _A     =  Image.fromarray(_UpperCAmelCase						)
       _A     =  {}
       _A     =  predicted_depth
       _A     =  depth
       return output_dict







"""simple docstring"""

def 		_snake_case	(   _snake_case				:   int							,    _snake_case				:   int				)       ->   int:






      '''simple docstring'''


      return int((input_a, input_a).count(1				) != 0				)






def 		_snake_case	(   )       ->   None:






      '''simple docstring'''


      assert or_gate(0							,    0				) == 0
      assert or_gate(0							,    1				) == 1
      assert or_gate(1							,    0				) == 1
      assert or_gate(1							,    1				) == 1


if __name__ == "__main__":
       print(or_gate(0, 1))
       print(or_gate(1, 0))
       print(or_gate(0, 0))
       print(or_gate(1, 1))

