





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__magic_name__       					=      {'''configuration_pegasus''': ['''PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusConfig''']}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__magic_name__       					=      ['''PegasusTokenizer''']

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__magic_name__       					=      ['''PegasusTokenizerFast''']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__magic_name__       					=      [
							    '''PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''PegasusForCausalLM''',
							    '''PegasusForConditionalGeneration''',
							    '''PegasusModel''',
							    '''PegasusPreTrainedModel''',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__magic_name__       					=      [
							    '''TFPegasusForConditionalGeneration''',
							    '''TFPegasusModel''',
							    '''TFPegasusPreTrainedModel''',
							]

try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__magic_name__       					=      [
							    '''FlaxPegasusForConditionalGeneration''',
							    '''FlaxPegasusModel''',
							    '''FlaxPegasusPreTrainedModel''',
							]


if TYPE_CHECKING:
							from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_pegasus import PegasusTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_pegasus_fast import PegasusTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_pegasus import (
														    PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
														    PegasusForCausalLM,
														    PegasusForConditionalGeneration,
														    PegasusModel,
														    PegasusPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_pegasus import (
														    FlaxPegasusForConditionalGeneration,
														    FlaxPegasusModel,
														    FlaxPegasusPreTrainedModel,
														)

else:
							import sys

							__magic_name__       					=      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





import math
import os

import cva
import numpy as np

__magic_name__       					=      2_55.0







def     __magic_name__  (      lowerCAmelCase_      ,					lowerCAmelCase_):
	'''simple docstring'''


	lowerCamelCase_			:							List[Any]      =       np.mean((original - contrast) ** 2)
	if mse == 0:
		return 100

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







def     __magic_name__  (      ):
	'''simple docstring'''


	lowerCamelCase_			:							List[str]      =       os.path.dirname(os.path.realpath(lowerCAmelCase_))
	# Loading images (original image and compressed image)
	lowerCamelCase_			:							Optional[int]      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/original_image.png"))
	lowerCamelCase_			:							List[str]      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/compressed_image.png")      ,					1)

	lowerCamelCase_			:							str      =       cva.imread(os.path.join(lowerCAmelCase_      ,					"image_data/PSNR-example-base.png"))
	lowerCamelCase_			:							int      =       cva.imread(
	    os.path.join(lowerCAmelCase_      ,					"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(lowerCAmelCase_      ,					lowerCAmelCase_)} dB""")

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


if __name__ == "__main__":
							main()

