





import math
import os

import cva
import numpy as np

_SCREAMING_SNAKE_CASE   						=		2_5_5.0


def 				SCREAMING_SNAKE_CASE__    (     __a ,			__a ):
	snake_case_		:      Optional[Any]           =						np.mean((original - contrast) ** 2 )
	if mse == 0:
		return 1_00

	return 20 * math.logaa(PIXEL_MAX / math.sqrt(__a ) )


def 				SCREAMING_SNAKE_CASE__    (     ):
	snake_case_		:      Any           =						os.path.dirname(os.path.realpath(__a ) )
	# Loading images (original image and compressed image)
	snake_case_		:      int           =						cva.imread(os.path.join(__a ,			'image_data/original_image.png' ) )
	snake_case_		:      Tuple           =						cva.imread(os.path.join(__a ,			'image_data/compressed_image.png' ) ,			1 )

	snake_case_		:      Dict           =						cva.imread(os.path.join(__a ,			'image_data/PSNR-example-base.png' ) )
	snake_case_		:      Optional[Any]           =						cva.imread(
	    os.path.join(__a ,			'image_data/PSNR-example-comp-10.jpg' ) ,			1 )

	# Value expected: 29.73dB
	print('-- First Test --' )
	print(f"""PSNR value is {peak_signal_to_noise_ratio(__a ,			__a )} dB""" )

	# # Value expected: 31.53dB (Wikipedia Example)
	print('\n-- Second Test --' )
	print(f"""PSNR value is {peak_signal_to_noise_ratio(__a ,			__a )} dB""" )


if __name__ == "__main__":
						main()








import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils
class SCREAMING_SNAKE_CASE_    (       unittest.TestCase       ):






						@patch('diffusers.utils.hub_utils.get_full_repo_name'						)
						def UpperCAmelCase_					(   self   :   Optional[int]		, _A   :   Mock						)				->     None:







							"""simple docstring"""


							snake_case_		:      Optional[Any]           =						'full_repo_name'
							with TemporaryDirectory() as tmpdir:
								# Dummy args values
								snake_case_		:      Optional[int]           =						Mock()
								snake_case_		:      Union[str, Any]           =						tmpdir
								snake_case_		:      Optional[Any]           =						0
								snake_case_		:      Union[str, Any]           =						'hub_token'
								snake_case_		:      Any           =						'dataset_name'
								snake_case_		:      Tuple           =						0.0_1
								snake_case_		:      Dict           =						100000
								snake_case_		:      Any           =						10000
								snake_case_		:      str           =						0.0_1
								snake_case_		:      Any           =						0.0_2
								snake_case_		:      Optional[Any]           =						0.0_3
								snake_case_		:      Tuple           =						0.0_0_0_5
								snake_case_		:      Tuple           =						0.0_0_0_0_0_1
								snake_case_		:      str           =						1
								snake_case_		:      Optional[int]           =						10
								snake_case_		:      List[str]           =						0.0_0_1
								snake_case_		:      Any           =						0.1
								snake_case_		:      List[str]           =						0.2
								snake_case_		:      Dict           =						True

								# Model card mush be rendered and saved
								diffusers.utils.hub_utils.create_model_card(_A		, model_name='model_name'						)
								self.assertTrue((Path(_A						) / 'README.md').is_file()						)

