"""simple docstring"""






from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase__    :    Any			=      logging.get_logger(__name__)

lowerCAmelCase__    :    Optional[int]			=      {
    'dandelin/vilt-b32-mlm': 'https://huggingface.co/dandelin/vilt-b32-mlm/blob/main/config.json'
}
class 							snake_case			(					__UpperCAmelCase							):




					"""simple docstring"""

					snake_case__							       =					"vilt"







					def __init__(							self  :      Union[str, Any]       ,lowerCamelCase__  :      Any=30_522       ,lowerCamelCase__  :      Tuple=2       ,lowerCamelCase__  :      int=2       ,lowerCamelCase__  :      str=40       ,lowerCamelCase__  :      Dict=768       ,lowerCamelCase__  :      Optional[Any]=12       ,lowerCamelCase__  :      Union[str, Any]=12       ,lowerCamelCase__  :      str=3_072       ,lowerCamelCase__  :      Dict="gelu"       ,lowerCamelCase__  :      Union[str, Any]=0.0       ,lowerCamelCase__  :      Any=0.0       ,lowerCamelCase__  :      List[Any]=0.0_2       ,lowerCamelCase__  :      Tuple=1e-12       ,lowerCamelCase__  :      str=384       ,lowerCamelCase__  :      Union[str, Any]=32       ,lowerCamelCase__  :      Optional[int]=3       ,lowerCamelCase__  :      int=True       ,lowerCamelCase__  :      Any=-1       ,lowerCamelCase__  :      int=False       ,lowerCamelCase__  :      Tuple=-1       ,**lowerCamelCase__  :      List[str]       ,):
									super().__init__(tie_word_embeddings=lowerCamelCase__       ,**lowerCamelCase__     )

									UpperCAmelCase__			 =				vocab_size
									UpperCAmelCase__			 =				type_vocab_size
									UpperCAmelCase__			 =				modality_type_vocab_size
									UpperCAmelCase__			 =				max_position_embeddings

									UpperCAmelCase__			 =				hidden_size
									UpperCAmelCase__			 =				num_hidden_layers
									UpperCAmelCase__			 =				num_attention_heads
									UpperCAmelCase__			 =				intermediate_size
									UpperCAmelCase__			 =				hidden_act
									UpperCAmelCase__			 =				hidden_dropout_prob
									UpperCAmelCase__			 =				attention_probs_dropout_prob
									UpperCAmelCase__			 =				initializer_range
									UpperCAmelCase__			 =				layer_norm_eps

									UpperCAmelCase__			 =				image_size
									UpperCAmelCase__			 =				patch_size
									UpperCAmelCase__			 =				num_channels
									UpperCAmelCase__			 =				qkv_bias
									UpperCAmelCase__			 =				max_image_length
									UpperCAmelCase__			 =				num_images




"""simple docstring"""






import requests

try:
						from django.contrib.auth import authenticate, login
						from django.shortcuts import redirect, render
except ImportError:
						lowerCAmelCase__    :    Union[str, Any]			=      print



def     a_		(   lowerCamelCase			):
				# Enter your recaptcha secret key here
				UpperCAmelCase__			 =				'secretKey'
				UpperCAmelCase__			 =				'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__			 =				request.POST.get('username'			)
				UpperCAmelCase__			 =				request.POST.get('password'			)
				UpperCAmelCase__			 =				request.POST.get('g-recaptcha-response'			)

				# post recaptcha response to Google's recaptcha api
				UpperCAmelCase__			 =				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__			 =				authenticate(lowerCamelCase   ,     username=lowerCamelCase   ,     password=lowerCamelCase			)
								if user_in_database:
												login(lowerCamelCase   ,     lowerCamelCase			)
												return redirect('/your-webpage'			)
				return render(lowerCamelCase   ,     'login.html'			)



