

"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import is_detectrona_available, logging


_A						=     logging.get_logger(__name__)

_A						=     {
    """layoutlmv2-base-uncased""": """https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/config.json""",
    """layoutlmv2-large-uncased""": """https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/config.json""",
    # See all LayoutLMv2 models at https://huggingface.co/models?filter=layoutlmv2
}

# soft dependency
if is_detectrona_available():
    import detectrona

class 			lowerCamelCase  (					lowerCAmelCase__      ):


  '''simple docstring'''







  SCREAMING_SNAKE_CASE							=     'layoutlmv2'



  def __init__(self       ,					_lowerCamelCase=30522       ,					_lowerCamelCase=768       ,					_lowerCamelCase=12       ,					_lowerCamelCase=12       ,					_lowerCamelCase=3072       ,					_lowerCamelCase="gelu"       ,					_lowerCamelCase=0.1       ,					_lowerCamelCase=0.1       ,					_lowerCamelCase=512       ,					_lowerCamelCase=2       ,					_lowerCamelCase=0.02       ,					_lowerCamelCase=1e-12       ,					_lowerCamelCase=0       ,					_lowerCamelCase=1024       ,					_lowerCamelCase=128       ,					_lowerCamelCase=32       ,					_lowerCamelCase=True       ,					_lowerCamelCase=256       ,					_lowerCamelCase=64       ,					_lowerCamelCase=True       ,					_lowerCamelCase=[7, 7, 256]       ,					_lowerCamelCase=128       ,					_lowerCamelCase=128       ,					_lowerCamelCase=True       ,					_lowerCamelCase=True       ,					_lowerCamelCase=False       ,					_lowerCamelCase=None       ,					**_lowerCamelCase       ,					):


        """simple docstring"""

        super().__init__(
            vocab_size=_lowerCamelCase       ,					hidden_size=_lowerCamelCase       ,					num_hidden_layers=_lowerCamelCase       ,					num_attention_heads=_lowerCamelCase       ,					intermediate_size=_lowerCamelCase       ,					hidden_act=_lowerCamelCase       ,					hidden_dropout_prob=_lowerCamelCase       ,					attention_probs_dropout_prob=_lowerCamelCase       ,					max_position_embeddings=_lowerCamelCase       ,					type_vocab_size=_lowerCamelCase       ,					initializer_range=_lowerCamelCase       ,					layer_norm_eps=_lowerCamelCase       ,					pad_token_id=_lowerCamelCase       ,					**_lowerCamelCase       ,					)
        UpperCAmelCase__ :       List[str]						=						max_ad_position_embeddings
        UpperCAmelCase__ :       Optional[Any]						=						max_rel_pos
        UpperCAmelCase__ :       List[str]						=						rel_pos_bins
        UpperCAmelCase__ :       List[Any]						=						fast_qkv
        UpperCAmelCase__ :       Optional[Any]						=						max_rel_ad_pos
        UpperCAmelCase__ :       str						=						rel_ad_pos_bins
        UpperCAmelCase__ :       str						=						convert_sync_batchnorm
        UpperCAmelCase__ :       Union[str, Any]						=						image_feature_pool_shape
        UpperCAmelCase__ :       Any						=						coordinate_size
        UpperCAmelCase__ :       int						=						shape_size
        UpperCAmelCase__ :       int						=						has_relative_attention_bias
        UpperCAmelCase__ :       Union[str, Any]						=						has_spatial_attention_bias
        UpperCAmelCase__ :       Union[str, Any]						=						has_visual_segment_embedding
        UpperCAmelCase__ :       Tuple						=						(
            detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
        )



  @classmethod
  def    _a			(self  ):


        """simple docstring"""

        return {
            "MODEL.MASK_ON": True,
            "MODEL.PIXEL_STD": [57.375, 57.120, 58.395],
            "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone",
            "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"],
            "MODEL.ANCHOR_GENERATOR.SIZES": [[32], [64], [128], [256], [512]],
            "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
            "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 2000,
            "MODEL.RPN.PRE_NMS_TOPK_TEST": 1000,
            "MODEL.RPN.POST_NMS_TOPK_TRAIN": 1000,
            "MODEL.POST_NMS_TOPK_TEST": 1000,
            "MODEL.ROI_HEADS.NAME": "StandardROIHeads",
            "MODEL.ROI_HEADS.NUM_CLASSES": 5,
            "MODEL.ROI_HEADS.IN_FEATURES": ["p2", "p3", "p4", "p5"],
            "MODEL.ROI_BOX_HEAD.NAME": "FastRCNNConvFCHead",
            "MODEL.ROI_BOX_HEAD.NUM_FC": 2,
            "MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION": 14,
            "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead",
            "MODEL.ROI_MASK_HEAD.NUM_CONV": 4,
            "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7,
            "MODEL.RESNETS.DEPTH": 101,
            "MODEL.RESNETS.SIZES": [[32], [64], [128], [256], [512]],
            "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]],
            "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"],
            "MODEL.RESNETS.NUM_GROUPS": 32,
            "MODEL.RESNETS.WIDTH_PER_GROUP": 8,
            "MODEL.RESNETS.STRIDE_IN_1X1": False,
        }




  def    _a			(self  ):


        """simple docstring"""

        UpperCAmelCase__ :       List[str]						=						detectrona.config.get_cfg()
        for k, v in self.detectrona_config_args.items():
              UpperCAmelCase__ :       Dict						=						k.split("""."""  )
              UpperCAmelCase__ :       Optional[Any]						=						detectrona_config
              for attribute in attributes[:-1]:
                    UpperCAmelCase__ :       Any						=						getattr(_lowerCamelCase       ,					_lowerCamelCase  )
              setattr(_lowerCamelCase       ,					attributes[-1]       ,					_lowerCamelCase  )

        return detectrona_config




"""simple docstring"""
import requests

try:
    from django.contrib.auth import authenticate, login
    from django.shortcuts import redirect, render
except ImportError:
    _A						=     _A						=     _A						=     _A						=     print




def 				a__	(	lowerCAmelCase						)  ->   str:
      # Enter your recaptcha secret key here
      UpperCAmelCase__ :       int						=						"""secretKey"""
      UpperCAmelCase__ :       Any						=						"""https://www.google.com/recaptcha/api/siteverify"""

      # when method is not POST, direct user to login page
      if request.method != "POST":
            return render(lowerCAmelCase ,  """login.html"""						)

      # from the frontend, get username, password, and client_key
      UpperCAmelCase__ :       List[Any]						=						request.POST.get("""username"""						)
      UpperCAmelCase__ :       Optional[Any]						=						request.POST.get("""password"""						)
      UpperCAmelCase__ :       List[str]						=						request.POST.get("""g-recaptcha-response"""						)

      # post recaptcha response to Google's recaptcha api
      UpperCAmelCase__ :       Any						=						requests.post(lowerCAmelCase ,  data={"""secret""": secret_key, """response""": client_key}						)
      # if the recaptcha api verified our keys
      if response.json().get("""success""" ,  lowerCAmelCase						):
            # authenticate the user
            UpperCAmelCase__ :       List[str]						=						authenticate(lowerCAmelCase ,  username=lowerCAmelCase ,  password=lowerCAmelCase						)
            if user_in_database:
                  login(lowerCAmelCase ,  lowerCAmelCase						)
                  return redirect("""/your-webpage"""						)
      return render(lowerCAmelCase ,  """login.html"""						)

