


'''simple docstring'''




import collections
import inspect
import unittest

from transformers import SwinConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_backbone_common import BackboneTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
				import torch
				from torch import nn

				from transformers import SwinBackbone, SwinForImageClassification, SwinForMaskedImageModeling, SwinModel
				from transformers.models.swin.modeling_swin import SWIN_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
				from PIL import Image

				from transformers import AutoImageProcessor





class _snake_case :
							"""simple docstring"""





							def __init__( self      ,					__A      ,					__A=13      ,					__A=32      ,					__A=2      ,					__A=3      ,					__A=16      ,					__A=[1, 2, 1]      ,					__A=[2, 2, 4]      ,					__A=2      ,					__A=2.0      ,					__A=True      ,					__A=0.0      ,					__A=0.0      ,					__A=0.1      ,					__A="gelu"      ,					__A=False      ,					__A=True      ,					__A=0.02      ,					__A=1E-5      ,					__A=True      ,					__A=None      ,					__A=True      ,					__A=10      ,					__A=8      ,					__A=["stage1", "stage2"]      ,					__A=[1, 2]      ,					)  ->Optional[int]:



											"""simple docstring"""







											__lowerCamelCase		:   Union[str, Any]           =       parent
											__lowerCamelCase		:   Optional[int]           =       batch_size
											__lowerCamelCase		:   List[str]           =       image_size
											__lowerCamelCase		:   Union[str, Any]           =       patch_size
											__lowerCamelCase		:   Optional[Any]           =       num_channels
											__lowerCamelCase		:   Union[str, Any]           =       embed_dim
											__lowerCamelCase		:   int           =       depths
											__lowerCamelCase		:   Optional[int]           =       num_heads
											__lowerCamelCase		:   Dict           =       window_size
											__lowerCamelCase		:   int           =       mlp_ratio
											__lowerCamelCase		:   Dict           =       qkv_bias
											__lowerCamelCase		:   Any           =       hidden_dropout_prob
											__lowerCamelCase		:   Any           =       attention_probs_dropout_prob
											__lowerCamelCase		:   Optional[int]           =       drop_path_rate
											__lowerCamelCase		:   Union[str, Any]           =       hidden_act
											__lowerCamelCase		:   Optional[Any]           =       use_absolute_embeddings
											__lowerCamelCase		:   str           =       patch_norm
											__lowerCamelCase		:   Tuple           =       layer_norm_eps
											__lowerCamelCase		:   Tuple           =       initializer_range
											__lowerCamelCase		:   Optional[Any]           =       is_training
											__lowerCamelCase		:   int           =       scope
											__lowerCamelCase		:   Dict           =       use_labels
											__lowerCamelCase		:   Any           =       type_sequence_label_size
											__lowerCamelCase		:   List[Any]           =       encoder_stride
											__lowerCamelCase		:   Dict           =       out_features
											__lowerCamelCase		:   int           =       out_indices







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase		:   str           =       floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

											__lowerCamelCase		:   Union[str, Any]           =       None
											if self.use_labels:
															__lowerCamelCase		:   Tuple           =       ids_tensor([self.batch_size]      ,					self.type_sequence_label_size						)

											__lowerCamelCase		:   Dict           =       self.get_config()

											return config, pixel_values, labels







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Any:



											"""simple docstring"""







											return SwinConfig(
											    image_size=self.image_size      ,					patch_size=self.patch_size      ,					num_channels=self.num_channels      ,					embed_dim=self.embed_dim      ,					depths=self.depths      ,					num_heads=self.num_heads      ,					window_size=self.window_size      ,					mlp_ratio=self.mlp_ratio      ,					qkv_bias=self.qkv_bias      ,					hidden_dropout_prob=self.hidden_dropout_prob      ,					attention_probs_dropout_prob=self.attention_probs_dropout_prob      ,					drop_path_rate=self.drop_path_rate      ,					hidden_act=self.hidden_act      ,					use_absolute_embeddings=self.use_absolute_embeddings      ,					path_norm=self.patch_norm      ,					layer_norm_eps=self.layer_norm_eps      ,					initializer_range=self.initializer_range      ,					encoder_stride=self.encoder_stride      ,					out_features=self.out_features      ,					out_indices=self.out_indices      ,					)







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A      ,					__A						)  ->List[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[Any]           =       SwinModel(config=__A						)
											model.to(__A						)
											model.eval()
											__lowerCamelCase		:   Optional[Any]           =       model(__A						)

											__lowerCamelCase		:   Dict           =       ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths						) - 1))
											__lowerCamelCase		:   Any           =       int(config.embed_dim * 2 ** (len(config.depths						) - 1)						)

											self.parent.assertEqual(result.last_hidden_state.shape      ,					(self.batch_size, expected_seq_len, expected_dim)						)







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A      ,					__A						)  ->int:



											"""simple docstring"""







											__lowerCamelCase		:   Union[str, Any]           =       SwinBackbone(config=__A						)
											model.to(__A						)
											model.eval()
											__lowerCamelCase		:   List[Any]           =       model(__A						)

											# verify hidden states
											self.parent.assertEqual(len(result.feature_maps						)      ,					len(config.out_features						)						)
											self.parent.assertListEqual(list(result.feature_maps[0].shape						)      ,					[self.batch_size, model.channels[0], 16, 16]						)

											# verify channels
											self.parent.assertEqual(len(model.channels						)      ,					len(config.out_features						)						)

											# verify backbone works with out_features=None
											__lowerCamelCase		:   List[Any]           =       None
											__lowerCamelCase		:   Optional[int]           =       SwinBackbone(config=__A						)
											model.to(__A						)
											model.eval()
											__lowerCamelCase		:   str           =       model(__A						)

											# verify feature maps
											self.parent.assertEqual(len(result.feature_maps						)      ,					1						)
											self.parent.assertListEqual(list(result.feature_maps[0].shape						)      ,					[self.batch_size, model.channels[-1], 4, 4]						)

											# verify channels
											self.parent.assertEqual(len(model.channels						)      ,					1						)







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A      ,					__A						)  ->Tuple:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       SwinForMaskedImageModeling(config=__A						)
											model.to(__A						)
											model.eval()
											__lowerCamelCase		:   int           =       model(__A						)
											self.parent.assertEqual(
											    result.logits.shape      ,					(self.batch_size, self.num_channels, self.image_size, self.image_size)						)

											# test greyscale images
											__lowerCamelCase		:   Tuple           =       1
											__lowerCamelCase		:   List[str]           =       SwinForMaskedImageModeling(__A						)
											model.to(__A						)
											model.eval()

											__lowerCamelCase		:   int           =       floats_tensor([self.batch_size, 1, self.image_size, self.image_size]						)
											__lowerCamelCase		:   List[Any]           =       model(__A						)
											self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, 1, self.image_size, self.image_size)						)







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A      ,					__A						)  ->Tuple:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       self.type_sequence_label_size
											__lowerCamelCase		:   List[str]           =       SwinForImageClassification(__A						)
											model.to(__A						)
											model.eval()
											__lowerCamelCase		:   Optional[Any]           =       model(__A      ,					labels=__A						)
											self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.type_sequence_label_size)						)

											# test greyscale images
											__lowerCamelCase		:   List[Any]           =       1
											__lowerCamelCase		:   Any           =       SwinForImageClassification(__A						)
											model.to(__A						)
											model.eval()

											__lowerCamelCase		:   Union[str, Any]           =       floats_tensor([self.batch_size, 1, self.image_size, self.image_size]						)
											__lowerCamelCase		:   List[Any]           =       model(__A						)
											self.parent.assertEqual(result.logits.shape      ,					(self.batch_size, self.type_sequence_label_size)						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Union[str, Any]:



											"""simple docstring"""







											__lowerCamelCase		:   List[Any]           =       self.prepare_config_and_inputs()
											(
											    (
											    __lowerCamelCase
											)    ,       (
											    __lowerCamelCase
											)    ,       (
											    __lowerCamelCase
											)    ,       
											)		:   Any           =       config_and_inputs
											__lowerCamelCase		:   Optional[Any]           =       {"pixel_values": pixel_values}
											return config, inputs_dict





@require_torch
class _snake_case (			a__     , a__     , unittest.TestCase ):
							"""simple docstring"""





							__a				       =  (
							    (
							        SwinModel,
							        SwinBackbone,
							        SwinForImageClassification,
							        SwinForMaskedImageModeling,
							    )
							    if is_torch_available()
							    else ()
							)
							__a				       =  (
							    {'''feature-extraction''': SwinModel, '''image-classification''': SwinForImageClassification}
							    if is_torch_available()
							    else {}
							)
							__a				       =  True

							__a				       =  False
							__a				       =  False
							__a				       =  False







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Any:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[Any]           =       SwinModelTester(self						)
											__lowerCamelCase		:   List[Any]           =       ConfigTester(self      ,					config_class=__A      ,					embed_dim=37						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Union[str, Any]:



											"""simple docstring"""







											self.create_and_test_config_common_properties()
											self.config_tester.create_and_test_config_to_json_string()
											self.config_tester.create_and_test_config_to_json_file()
											self.config_tester.create_and_test_config_from_and_save_pretrained()
											self.config_tester.create_and_test_config_with_num_labels()
											self.config_tester.check_config_can_be_init_without_params()
											self.config_tester.check_config_arguments_init()







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Tuple:



											"""simple docstring"""







											return







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Dict:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*__A						)







							@unittest.skip(reason="Got `CUDA error: misaligned address` with PyTorch 2.0.0."						)
							def 		__SCREAMING_SNAKE_CASE( self						)  ->Tuple:



											"""simple docstring"""







											pass







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[int]:



											"""simple docstring"""







											super().test_training_gradient_checkpointing()







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_backbone(*__A						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->int:



											"""simple docstring"""







											__lowerCamelCase		:   str           =       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_image_modeling(*__A						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[int]           =       self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_image_classification(*__A						)







							@unittest.skip(reason="Swin does not use inputs_embeds"						)
							def 		__SCREAMING_SNAKE_CASE( self						)  ->Any:



											"""simple docstring"""







											pass







							@unittest.skip(reason="Swin Transformer does not use feedforward chunking"						)
							def 		__SCREAMING_SNAKE_CASE( self						)  ->Any:



											"""simple docstring"""







											pass







							def 		__SCREAMING_SNAKE_CASE( self						)  ->str:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   Union[str, Any]           =       self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
															__lowerCamelCase		:   Optional[int]           =       model_class(__A						)
															self.assertIsInstance(model.get_input_embeddings()      ,					(nn.Module)						)
															__lowerCamelCase		:   Tuple           =       model.get_output_embeddings()
															self.assertTrue(x is None or isinstance(__A      ,					nn.Linear						)						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->str:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   str           =       self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
															__lowerCamelCase		:   Any           =       model_class(__A						)
															__lowerCamelCase		:   List[Any]           =       inspect.signature(model.forward						)
															# signature.parameters is an OrderedDict => so arg_names order is deterministic
															__lowerCamelCase		:   List[Any]           =       [*signature.parameters.keys()]

															__lowerCamelCase		:   Dict           =       ["pixel_values"]
															self.assertListEqual(arg_names[:1]      ,					__A						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[int]:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   Union[str, Any]           =       self.model_tester.prepare_config_and_inputs_for_common()
											__lowerCamelCase		:   Dict           =       True

											for model_class in self.all_model_classes:
															__lowerCamelCase		:   List[str]           =       True
															__lowerCamelCase		:   str           =       False
															__lowerCamelCase		:   List[Any]           =       True
															__lowerCamelCase		:   Optional[Any]           =       model_class(__A						)
															model.to(__A						)
															model.eval()
															with torch.no_grad():
																			__lowerCamelCase		:   Dict           =       model(**self._prepare_for_class(__A      ,					__A						)						)
															__lowerCamelCase		:   int           =       outputs.attentions
															__lowerCamelCase		:   Optional[int]           =       len(self.model_tester.depths						)
															self.assertEqual(len(__A						)      ,					__A						)

															# check that output_attentions also work using config
															del inputs_dict["output_attentions"]
															__lowerCamelCase		:   Optional[Any]           =       True
															__lowerCamelCase		:   List[Any]           =       config.window_size**2
															__lowerCamelCase		:   str           =       model_class(__A						)
															model.to(__A						)
															model.eval()
															with torch.no_grad():
																			__lowerCamelCase		:   Optional[int]           =       model(**self._prepare_for_class(__A      ,					__A						)						)
															__lowerCamelCase		:   List[str]           =       outputs.attentions
															self.assertEqual(len(__A						)      ,					__A						)

															self.assertListEqual(
															    list(attentions[0].shape[-3:]						)      ,					[self.model_tester.num_heads[0], window_size_squared, window_size_squared]      ,					)
															__lowerCamelCase		:   Optional[Any]           =       len(__A						)

															# Check attention is always last and order is fine
															__lowerCamelCase		:   List[str]           =       True
															__lowerCamelCase		:   int           =       True
															__lowerCamelCase		:   List[Any]           =       model_class(__A						)
															model.to(__A						)
															model.eval()
															with torch.no_grad():
																			__lowerCamelCase		:   Any           =       model(**self._prepare_for_class(__A      ,					__A						)						)

															# also another +1 for reshaped_hidden_states
															__lowerCamelCase		:   Dict           =       1 if model_class.__name__ == "SwinBackbone" else 2
															self.assertEqual(out_len + added_hidden_states      ,					len(__A						)						)

															__lowerCamelCase		:   List[str]           =       outputs.attentions

															self.assertEqual(len(__A						)      ,					__A						)

															self.assertListEqual(
															    list(self_attentions[0].shape[-3:]						)      ,					[self.model_tester.num_heads[0], window_size_squared, window_size_squared]      ,					)







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A      ,					__A      ,					__A						)  ->List[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   List[Any]           =       model_class(__A						)
											model.to(__A						)
											model.eval()

											with torch.no_grad():
															__lowerCamelCase		:   str           =       model(**self._prepare_for_class(__A      ,					__A						)						)

											__lowerCamelCase		:   Optional[Any]           =       outputs.hidden_states

											__lowerCamelCase		:   List[str]           =       getattr(
											    self.model_tester      ,					"expected_num_hidden_layers"      ,					len(self.model_tester.depths						) + 1						)
											self.assertEqual(len(__A						)      ,					__A						)

											# Swin has a different seq_length
											__lowerCamelCase		:   Tuple           =       (
											    config.patch_size
											    if isinstance(config.patch_size      ,					collections.abc.Iterable						)
											    else (config.patch_size, config.patch_size)
											)

											__lowerCamelCase		:   int           =       (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

											self.assertListEqual(
											    list(hidden_states[0].shape[-2:]						)      ,					[num_patches, self.model_tester.embed_dim]      ,					)

											if not model_class.__name__ == "SwinBackbone":
															__lowerCamelCase		:   str           =       outputs.reshaped_hidden_states
															self.assertEqual(len(__A						)      ,					__A						)

															__lowerCamelCase    ,       __lowerCamelCase    ,       __lowerCamelCase    ,       __lowerCamelCase		:   str           =       reshaped_hidden_states[0].shape
															__lowerCamelCase		:   str           =       (
															    reshaped_hidden_states[0].view(__A      ,					__A      ,					height * width						).permute(0      ,					2      ,					1						)
															)
															self.assertListEqual(
															    list(reshaped_hidden_states.shape[-2:]						)      ,					[num_patches, self.model_tester.embed_dim]      ,					)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->int:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   Tuple           =       self.model_tester.prepare_config_and_inputs_for_common()

											__lowerCamelCase		:   Optional[int]           =       (
											    self.model_tester.image_size
											    if isinstance(self.model_tester.image_size      ,					collections.abc.Iterable						)
											    else (self.model_tester.image_size, self.model_tester.image_size)
											)

											for model_class in self.all_model_classes:
															__lowerCamelCase		:   Dict           =       True
															self.check_hidden_states_output(__A      ,					__A      ,					__A      ,					__A						)

															# check that output_hidden_states also work using config
															del inputs_dict["output_hidden_states"]
															__lowerCamelCase		:   Optional[int]           =       True

															self.check_hidden_states_output(__A      ,					__A      ,					__A      ,					__A						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Tuple:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   Any           =       self.model_tester.prepare_config_and_inputs_for_common()
											__lowerCamelCase		:   List[Any]           =       3

											__lowerCamelCase		:   Optional[Any]           =       (
											    self.model_tester.image_size
											    if isinstance(self.model_tester.image_size      ,					collections.abc.Iterable						)
											    else (self.model_tester.image_size, self.model_tester.image_size)
											)
											__lowerCamelCase		:   Optional[int]           =       (
											    config.patch_size
											    if isinstance(config.patch_size      ,					collections.abc.Iterable						)
											    else (config.patch_size, config.patch_size)
											)

											__lowerCamelCase		:   Any           =       image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
											__lowerCamelCase		:   List[str]           =       image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

											for model_class in self.all_model_classes:
															__lowerCamelCase		:   Dict           =       True
															self.check_hidden_states_output(__A      ,					__A      ,					__A      ,					(padded_height, padded_width)						)

															# check that output_hidden_states also work using config
															del inputs_dict["output_hidden_states"]
															__lowerCamelCase		:   Optional[int]           =       True
															self.check_hidden_states_output(__A      ,					__A      ,					__A      ,					(padded_height, padded_width)						)







							@slow
							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											for model_name in SWIN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
															__lowerCamelCase		:   Dict           =       SwinModel.from_pretrained(__A						)
															self.assertIsNotNone(__A						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase    ,       __lowerCamelCase		:   str           =       self.model_tester.prepare_config_and_inputs_for_common()

											__lowerCamelCase		:   List[str]           =       _config_zero_init(__A						)
											for model_class in self.all_model_classes:
															__lowerCamelCase		:   str           =       model_class(config=__A						)
															for name, param in model.named_parameters():
																			if "embeddings" not in name and param.requires_grad:
																							self.assertIn(
																							    ((param.data.mean() * 1E9).round() / 1E9).item()      ,					[0.0, 1.0]      ,					msg=f'Parameter {name} of model {model_class} seems not properly initialized'      ,					)





@require_vision
@require_torch
class _snake_case (			unittest.TestCase ):
							"""simple docstring"""





							@cached_property
							def 		__SCREAMING_SNAKE_CASE( self						)  ->int:



											"""simple docstring"""







											return (
											    AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224"						)
											    if is_vision_available()
											    else None
											)







							@slow
							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       SwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224"						).to(__A						)
											__lowerCamelCase		:   Tuple           =       self.default_image_processor

											__lowerCamelCase		:   Optional[int]           =       Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"						)
											__lowerCamelCase		:   Any           =       image_processor(images=__A      ,					return_tensors="pt"						).to(__A						)

											# forward pass
											with torch.no_grad():
															__lowerCamelCase		:   str           =       model(**__A						)

											# verify the logits
											__lowerCamelCase		:   Tuple           =       torch.Size((1, 1000)						)
											self.assertEqual(outputs.logits.shape      ,					__A						)
											__lowerCamelCase		:   List[Any]           =       torch.tensor([-0.0948, -0.6454, -0.0921]						).to(__A						)
											self.assertTrue(torch.allclose(outputs.logits[0, :3]      ,					__A      ,					atol=1E-4						)						)





@require_torch
class _snake_case (			unittest.TestCase     , a__ ):
							"""simple docstring"""





							__a				       =  (SwinBackbone,) if is_torch_available() else ()
							__a				       =  SwinConfig







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[int]:



											"""simple docstring"""







											__lowerCamelCase		:   List[Any]           =       SwinModelTester(self						)









'''simple docstring'''




import requests

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





def 				a_							(    lowercase     )      ->Any:






				'''simple docstring'''

				__lowerCamelCase		:   str           =       "secretKey"
				__lowerCamelCase		:   Optional[Any]           =       "https://www.google.com/recaptcha/api/siteverify"

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

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

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





