






'''simple docstring'''
from PIL import Image





def 	_a(					UpperCamelCase__			:  Image							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__						,		SCREAMING_SNAKE_CASE__       :			str													=image.size
      SCREAMING_SNAKE_CASE__       :			List[Any]													=0
      SCREAMING_SNAKE_CASE__       :			Dict													=image.load()
      for i in range(SCREAMING_SNAKE_CASE_							):
            for j in range(SCREAMING_SNAKE_CASE_							):
                  SCREAMING_SNAKE_CASE__       :			List[str]													=pixels[j, i]
                  mean += pixel
      mean //= width * height

      for j in range(SCREAMING_SNAKE_CASE_							):
            for i in range(SCREAMING_SNAKE_CASE_							):
                  SCREAMING_SNAKE_CASE__       :			Tuple													=2_5_5 if pixels[i, j] > mean else 0
      return image


if __name__ == "__main__":
  a_					=	mean_threshold(Image.open('path_to_image').convert('L'))
  image.save('output_image_path')







'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a_					=	{
    'configuration_megatron_bert': ['MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegatronBertConfig'],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a_					=	[
      'MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST',
      'MegatronBertForCausalLM',
      'MegatronBertForMaskedLM',
      'MegatronBertForMultipleChoice',
      'MegatronBertForNextSentencePrediction',
      'MegatronBertForPreTraining',
      'MegatronBertForQuestionAnswering',
      'MegatronBertForSequenceClassification',
      'MegatronBertForTokenClassification',
      'MegatronBertModel',
      'MegatronBertPreTrainedModel',
  ]

if TYPE_CHECKING:
  from .configuration_megatron_bert import MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, MegatronBertConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_megatron_bert import (
        MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        MegatronBertForCausalLM,
        MegatronBertForMaskedLM,
        MegatronBertForMultipleChoice,
        MegatronBertForNextSentencePrediction,
        MegatronBertForPreTraining,
        MegatronBertForQuestionAnswering,
        MegatronBertForSequenceClassification,
        MegatronBertForTokenClassification,
        MegatronBertModel,
        MegatronBertPreTrainedModel,
    )

else:
  import sys

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