





"""simple docstring"""






from ...processing_utils import ProcessorMixin




class  __lowercase	(	SCREAMING_SNAKE_CASE_							):







					'''simple docstring'''




					__lowerCAmelCase     =     "WhisperFeatureExtractor"
					__lowerCAmelCase     =     "WhisperTokenizer"







					def __init__(  self		,	_UpperCAmelCase		,	_UpperCAmelCase   ):
									super().__init__(a__		,	a__   )
									__a       :  int					=     self.feature_extractor
									__a       :  Union[str, Any]					=     False







					def        _lowerCamelCase						(  self		,	_UpperCAmelCase=None		,	_UpperCAmelCase=None		,	_UpperCAmelCase=True   ):
									return self.tokenizer.get_decoder_prompt_ids(task=a__		,	language=a__		,	no_timestamps=a__   )







					def __call__(  self		,	*_UpperCAmelCase		,	**_UpperCAmelCase   ):
									# For backward compatibility
									if self._in_target_context_manager:
													return self.current_processor(*a__		,	**a__   )

									__a       :  Union[str, Any]					=     kwargs.pop('''audio'''		,	a__   )
									__a       :  Dict					=     kwargs.pop('''sampling_rate'''		,	a__   )
									__a       :  Optional[Any]					=     kwargs.pop('''text'''		,	a__   )
									if len(a__   ) > 0:
													__a       :  Any					=     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       :  str					=     self.feature_extractor(a__		,	*a__		,	sampling_rate=a__		,	**a__   )
									if text is not None:
													__a       :  Any					=     self.tokenizer(a__		,	**a__   )

									if text is None:
													return inputs

									elif audio is None:
													return encodings
									else:
													__a       :  Any					=     encodings["""input_ids"""]
													return inputs







					def        _lowerCamelCase						(  self		,	*_UpperCAmelCase		,	**_UpperCAmelCase   ):
									return self.tokenizer.batch_decode(*a__		,	**a__   )







					def        _lowerCamelCase						(  self		,	*_UpperCAmelCase		,	**_UpperCAmelCase   ):
									return self.tokenizer.decode(*a__		,	**a__   )







					def        _lowerCamelCase						(  self		,	_UpperCAmelCase		,	_UpperCAmelCase="np"   ):
									return self.tokenizer.get_prompt_ids(a__		,	return_tensors=a__   )
"""simple docstring"""




from itertools import product

from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Optional[Any]			,_lowerCamelCase						:       int	)       ->      List[str]:
  _lowerCAmelCase						:       Tuple  			=     k_size // 2
  _lowerCAmelCase			,	_lowerCAmelCase						:       List[str]  			=     mgrid[0 - center : k_size - center, 0 - center : k_size - center]
  _lowerCAmelCase						:       Union[str, Any]  			=     1 / (2 * pi * sigma) * exp(-(square(_lowerCamelCase	) + square(_lowerCamelCase	)) / (2 * square(_lowerCamelCase	))	)
  return g





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Dict			,_lowerCamelCase						:       int			,_lowerCamelCase						:       int	)       ->      Dict:
  _lowerCAmelCase			,	_lowerCAmelCase						:       str  			=     image.shape[0], image.shape[1]
  # dst image height and width
  _lowerCAmelCase						:       Optional[int]  			=     height - k_size + 1
  _lowerCAmelCase						:       Dict  			=     width - k_size + 1

  # im2col, turn the k_size*k_size pixels into a row and np.vstack all rows
  _lowerCAmelCase						:       Tuple  			=     zeros((dst_height * dst_width, k_size * k_size)	)
  _lowerCAmelCase						:       int  			=     0
  for i, j in product(range(_lowerCamelCase	)			,range(_lowerCamelCase	)	):
    _lowerCAmelCase						:       Any  			=     ravel(image[i : i + k_size, j : j + k_size]	)
    _lowerCAmelCase						:       Union[str, Any]  			=     window
    row += 1

  #  turn the kernel into shape(k*k, 1)
  _lowerCAmelCase						:       List[Any]  			=     gen_gaussian_kernel(_lowerCamelCase			,_lowerCamelCase	)
  _lowerCAmelCase						:       str  			=     ravel(_lowerCamelCase	)

  # reshape and get the dst image
  _lowerCAmelCase						:       int  			=     dot(_lowerCamelCase			,_lowerCamelCase	).reshape(_lowerCamelCase			,_lowerCamelCase	).astype(_lowerCamelCase	)

  return dst


if __name__ == "__main__":
     # read original image
     _a      :		Optional[Any]           =   imread(r'../image_data/lena.jpg')
     # turn image in gray scale value
     _a      :		Dict           =   cvtColor(img, COLOR_BGR2GRAY)

     # get values with two different mask size
     _a      :		Union[str, Any]           =   gaussian_filter(gray, 3, sigma=1)
     _a      :		List[Any]           =   gaussian_filter(gray, 5, sigma=0.8)

     # show result images
     imshow('gaussian filter with 3x3 mask', gaussianaxa)
     imshow('gaussian filter with 5x5 mask', gaussianaxa)
     waitKey()




