"""simple docstring"""
import numpy as np
import torch
import torch.nn as nn
from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel

from ...utils import logging


SCREAMING_SNAKE_CASE__   =					logging.get_logger(__name__)



class 					lowerCAmelCase_      (     lowerCAmelCase   ):



    """simple docstring"""
    _lowerCAmelCase       :      List[str]     					=  CLIPConfig

    _lowerCAmelCase       :      Dict     					=  ["""CLIPEncoderLayer"""]

    def __init__(			self						,      lowerCAmelCase      ):






          """simple docstring"""

          super().__init__(_a      )

          snake_case        =     CLIPVisionModelWithProjection(config.vision_config      )

          snake_case        =     nn.Linear(config.vision_config.projection_dim						,      1      )
          snake_case        =     nn.Linear(config.vision_config.projection_dim						,      1      )

    @torch.no_grad()
    def 						snake_case	(			self						,      lowerCAmelCase						,      lowerCAmelCase						,      lowerCAmelCase=0.5						,      lowerCAmelCase=0.5      ):






          """simple docstring"""

          snake_case        =     self.vision_model(_a      )[0]

          snake_case        =     self.p_head(_a      )
          snake_case        =     nsfw_detected.flatten()
          snake_case        =     nsfw_detected > p_threshold
          snake_case        =     nsfw_detected.tolist()

          if any(_a      ):
                logger.warning(
                    'Potential NSFW content was detected in one or more images. A black image will be returned instead.'
                    ' Try again with a different prompt and/or seed.'      )

          for idx, nsfw_detected_ in enumerate(_a      ):
                if nsfw_detected_:
                      snake_case        =     np.zeros(images[idx].shape      )

          snake_case        =     self.w_head(_a      )
          snake_case        =     watermark_detected.flatten()
          snake_case        =     watermark_detected > w_threshold
          snake_case        =     watermark_detected.tolist()

          if any(_a      ):
                logger.warning(
                    'Potential watermarked content was detected in one or more images. A black image will be returned instead.'
                    ' Try again with a different prompt and/or seed.'      )

          for idx, watermark_detected_ in enumerate(_a      ):
                if watermark_detected_:
                      snake_case        =     np.zeros(images[idx].shape      )

          return images, nsfw_detected, watermark_detected



"""simple docstring"""
def 				lowerCAmelCase__      (     _UpperCamelCase    :			str   )   ->			bool:





						"""simple docstring"""






						if not all(x.isalpha() for x in string   ):
												raise ValueError('String must only contain alphabetic characters.'   )

						snake_case        =     sorted(string.lower()   )
						return len(_UpperCamelCase   ) == len(set(_UpperCamelCase   )   )


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE__   =					input("Enter a string ").strip()

					SCREAMING_SNAKE_CASE__   =					is_isogram(input_str)
					print(f"""{input_str} is {'an' if isogram else 'not an'} isogram.""")


