
'''simple docstring'''





from cva import destroyAllWindows, imread, imshow, waitKey





def 							snake_case				(		UpperCAmelCase   ,	UpperCAmelCase						)->      Dict:







      """simple docstring"""
      __A						,   __A													=      img.shape[0], img.shape[1]

      def to_grayscale(UpperCAmelCase   ,	UpperCAmelCase   ,	UpperCAmelCase						):
            return 0.2126 * red + 0.587 * green + 0.114 * blue

      def normalize(UpperCAmelCase						):
            return min(UpperCAmelCase   ,	2_5_5						)

      for i in range(UpperCAmelCase						):
            for j in range(UpperCAmelCase						):
                  __A													=      int(to_grayscale(*img[i][j]						)						)
                  __A													=      [
                      normalize(UpperCAmelCase						),
                      normalize(greyscale + factor						),
                      normalize(greyscale + 2 * factor						),
                  ]

      return img


if __name__ == "__main__":
 # read original image
 a__		: Any  							=							{
     percentage: imread("image_data/lena.jpg", 1) for percentage in (1_0, 2_0, 3_0, 4_0)
 }

 for percentage, img in images.items():
  make_sepia(img, percentage)

 for percentage, img in images.items():
  imshow(f'''Original image with sepia (factor: {percentage})''', img)

 waitKey(0)
 destroyAllWindows()








'''simple docstring'''





import os
import unittest

import pytest
from parameterized import parameterized

from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device


# skipping in unittest tests

a__		: Tuple  							=							[(1,)]





def 							snake_case				(		)->      Union[str, Any]:







      """simple docstring"""
      __A													=      bool(os.getenv('RUN_SLOW'   ,	0						)						)
      if run_slow:
            assert True
      else:
            assert False, "should have been skipped"





def 							snake_case				(		)->      Tuple:







      """simple docstring"""
      __A													=      bool(os.getenv('RUN_SLOW'   ,	0						)						)
      if run_slow and torch_device == "cuda":
            assert True
      else:
            assert False, "should have been skipped"


@require_torch
class 			UpperCamelCase__	(     unittest.TestCase):






 @slow
 @require_torch_gpu
 def 						lowercase_    (      self	:Dict      )					->      List[Any]:







       '''simple docstring'''



       check_slow_torch_cuda()






 @require_torch_gpu
 @slow
 def 						lowercase_    (      self	:int      )					->      int:







       '''simple docstring'''



       check_slow_torch_cuda()






 @parameterized.expand(_A      )
 @slow
 def 						lowercase_    (      self	:Dict						,					_A	:Union[str, Any]=None      )					->      Dict:







       '''simple docstring'''



       check_slow()





@slow
@require_torch_gpu
def 							snake_case				(		)->      Optional[int]:







      """simple docstring"""
      check_slow_torch_cuda()





@require_torch_gpu
@slow
def 							snake_case				(		)->      List[str]:







      """simple docstring"""
      check_slow_torch_cuda()





@slow
@pytest.mark.parametrize('param'   ,	[1]						)
def 							snake_case				(		UpperCAmelCase						)->      int:







      """simple docstring"""
      check_slow()





@pytest.mark.parametrize('param'   ,	[1]						)
@slow
def 							snake_case				(		UpperCAmelCase						)->      Any:







      """simple docstring"""
      check_slow()






