


'''simple docstring'''
from ...processing_utils import ProcessorMixin

class     _lowerCamelCase       (     snake_case_					):




 '''simple docstring'''
 __lowercase					:		str     				=    '''WhisperFeatureExtractor'''
 __lowercase					:		List[Any]     				=    '''WhisperTokenizer'''


 def __init__(   self   ,   __lowercase   ,   __lowercase    ):

  """simple docstring"""







  super().__init__(__lowercase   ,   __lowercase    )
  __A	:		Union[str, Any]	  =      self.feature_extractor
  __A	:		str	  =      False


 def 			snake_case__ (   self   ,   __lowercase=None   ,   __lowercase=None   ,   __lowercase=True    ):

  """simple docstring"""







  return self.tokenizer.get_decoder_prompt_ids(task=__lowercase   ,   language=__lowercase   ,   no_timestamps=__lowercase    )


 def __call__(   self   ,   *__lowercase   ,   **__lowercase    ):

  """simple docstring"""







  if self._in_target_context_manager:
   return self.current_processor(*__lowercase   ,   **__lowercase    )

  __A	:		List[str]	  =      kwargs.pop('audio'   ,   __lowercase    )
  __A	:		List[Any]	  =      kwargs.pop('sampling_rate'   ,   __lowercase    )
  __A	:		Any	  =      kwargs.pop('text'   ,   __lowercase    )
  if len(__lowercase    ) > 0:
   __A	:		str	  =      args[0]
   __A	:		int	  =      args[1:]

  if audio is None and text is None:
   raise ValueError('You need to specify either an `audio` or `text` input to process.'    )

  if audio is not None:
   __A	:		Optional[Any]	  =      self.feature_extractor(__lowercase   ,   *__lowercase   ,   sampling_rate=__lowercase   ,   **__lowercase    )
  if text is not None:
   __A	:		Any	  =      self.tokenizer(__lowercase   ,   **__lowercase    )

  if text is None:
   return inputs

  elif audio is None:
   return encodings
  else:
   __A	:		List[str]	  =      encodings['input_ids']
   return inputs


 def 			snake_case__ (   self   ,   *__lowercase   ,   **__lowercase    ):

  """simple docstring"""







  return self.tokenizer.batch_decode(*__lowercase   ,   **__lowercase    )


 def 			snake_case__ (   self   ,   *__lowercase   ,   **__lowercase    ):

  """simple docstring"""







  return self.tokenizer.decode(*__lowercase   ,   **__lowercase    )







 def 			snake_case__ (   self   ,   __lowercase   ,   __lowercase="np"    ):

  """simple docstring"""







  return self.tokenizer.get_prompt_ids(__lowercase   ,   return_tensors=__lowercase    )










'''simple docstring'''
import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey

class     _lowerCamelCase       :




 '''simple docstring'''


 def __init__(   self   ,   __lowercase   ,   __lowercase   ,   __lowercase    ):

  """simple docstring"""







  if dst_width < 0 or dst_height < 0:
   raise ValueError('Destination width/height should be > 0'    )

  __A	:		Dict	  =      img
  __A	:		Dict	  =      img.shape[1]
  __A	:		Tuple	  =      img.shape[0]
  __A	:		List[str]	  =      dst_width
  __A	:		Tuple	  =      dst_height

  __A	:		Optional[Any]	  =      self.src_w / self.dst_w
  __A	:		List[str]	  =      self.src_h / self.dst_h

  __A	:		Dict	  =      (
      np.ones((self.dst_h, self.dst_w, 3)   ,   np.uinta    ) * 255
  )


 def 			snake_case__ (   self    ):

  """simple docstring"""







  for i in range(self.dst_h    ):
   for j in range(self.dst_w    ):
    __A	:		List[str]	  =      self.img[self.get_y(__lowercase    )][self.get_x(__lowercase    )]


 def 			snake_case__ (   self   ,   __lowercase    ):

  """simple docstring"""







  return int(self.ratio_x * x    )







 def 			snake_case__ (   self   ,   __lowercase    ):

  """simple docstring"""







  return int(self.ratio_y * y    )


if __name__ == "__main__":
 UpperCAmelCase_				,      UpperCAmelCase_			:  str										=   8_0_0, 6_0_0
 UpperCAmelCase_			:  str										=   imread('image_data/lena.jpg', 1)
 UpperCAmelCase_			:  List[str]										=   NearestNeighbour(im, dst_w, dst_h)
 n.process()

 imshow(
     f'''Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}''', n.output
 )
 waitKey(0)
 destroyAllWindows()






