





"""simple docstring"""


from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
  from transformers import (
      AutoConfig,
      BertConfig,
      GPTaConfig,
      TaConfig,
      TFAutoModel,
      TFAutoModelForCausalLM,
      TFAutoModelForMaskedLM,
      TFAutoModelForPreTraining,
      TFAutoModelForQuestionAnswering,
      TFAutoModelForSeqaSeqLM,
      TFAutoModelForSequenceClassification,
      TFAutoModelWithLMHead,
      TFBertForMaskedLM,
      TFBertForPreTraining,
      TFBertForQuestionAnswering,
      TFBertForSequenceClassification,
      TFBertModel,
      TFGPTaLMHeadModel,
      TFRobertaForMaskedLM,
      TFTaForConditionalGeneration,
  )
  from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
  from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
  from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
  from transformers import (
      AutoModel,
      AutoModelForCausalLM,
      AutoModelForMaskedLM,
      AutoModelForPreTraining,
      AutoModelForQuestionAnswering,
      AutoModelForSeqaSeqLM,
      AutoModelForSequenceClassification,
      AutoModelWithLMHead,
      BertForMaskedLM,
      BertForPreTraining,
      BertForQuestionAnswering,
      BertForSequenceClassification,
      BertModel,
      GPTaLMHeadModel,
      RobertaForMaskedLM,
      TaForConditionalGeneration,
  )



@is_pt_tf_cross_test
class      __SCREAMING_SNAKE_CASE    (						unittest.TestCase   ):







  '''simple docstring'''


  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       List[Any]	)		->				Union[str, Any]:
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
              _UpperCamelCase      :	Tuple						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	str						=       TFAutoModel.from_pretrained(__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	List[str]						=       AutoModel.from_pretrained(__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]	)		->				str:
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
              _UpperCamelCase      :	Dict						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Optional[int]						=       TFAutoModelForPreTraining.from_pretrained(__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Dict						=       AutoModelForPreTraining.from_pretrained(__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]	)		->				Dict:
        for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              _UpperCamelCase      :	Any						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Union[str, Any]						=       TFAutoModelForCausalLM.from_pretrained(__a					,   from_pt=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	int						=       TFAutoModelForCausalLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Optional[int]						=       AutoModelForCausalLM.from_pretrained(__a					,   from_tf=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	str						=       AutoModelForCausalLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       int	)		->				Any:
        for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              _UpperCamelCase      :	str						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	List[Any]						=       TFAutoModelWithLMHead.from_pretrained(__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	List[str]						=       AutoModelWithLMHead.from_pretrained(__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[Any]	)		->				str:
        for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              _UpperCamelCase      :	Optional[Any]						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Union[str, Any]						=       TFAutoModelForMaskedLM.from_pretrained(__a					,   from_pt=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	List[str]						=       TFAutoModelForMaskedLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	List[Any]						=       AutoModelForMaskedLM.from_pretrained(__a					,   from_tf=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	Union[str, Any]						=       AutoModelForMaskedLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[int]	)		->				str:
        for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              _UpperCamelCase      :	int						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	int						=       TFAutoModelForSeqaSeqLM.from_pretrained(__a					,   from_pt=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	Tuple						=       TFAutoModelForSeqaSeqLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Tuple						=       AutoModelForSeqaSeqLM.from_pretrained(__a					,   from_tf=__a	)
              _UpperCamelCase,  _UpperCamelCase      :	Optional[int]						=       AutoModelForSeqaSeqLM.from_pretrained(
                  __a					,   output_loading_info=__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       Union[str, Any]	)		->				Any:
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
              _UpperCamelCase      :	List[Any]						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	str						=       TFAutoModelForSequenceClassification.from_pretrained(__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	Optional[int]						=       AutoModelForSequenceClassification.from_pretrained(__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  @slow
  def    __SCREAMING_SNAKE_CASE				(		self   :       str	)		->				Tuple:
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
              _UpperCamelCase      :	int						=       AutoConfig.from_pretrained(__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	List[Any]						=       TFAutoModelForQuestionAnswering.from_pretrained(__a					,   from_pt=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

              _UpperCamelCase      :	str						=       AutoModelForQuestionAnswering.from_pretrained(__a					,   from_tf=__a	)
              self.assertIsNotNone(__a	)
              self.assertIsInstance(__a					,   __a	)

  def    __SCREAMING_SNAKE_CASE				(		self   :       Dict	)		->				str:
        _UpperCamelCase      :	List[str]						=       TFAutoModelWithLMHead.from_pretrained(__a					,   from_pt=__a	)
        self.assertIsInstance(__a					,   __a	)
        self.assertEqual(model.num_parameters()					,   1_4410	)
        self.assertEqual(model.num_parameters(only_trainable=__a	)					,   1_4410	)

        _UpperCamelCase      :	Optional[int]						=       AutoModelWithLMHead.from_pretrained(__a					,   from_tf=__a	)
        self.assertIsInstance(__a					,   __a	)
        self.assertEqual(model.num_parameters()					,   1_4410	)
        self.assertEqual(model.num_parameters(only_trainable=__a	)					,   1_4410	)


  def    __SCREAMING_SNAKE_CASE				(		self   :       Tuple	)		->				List[Any]:
        _UpperCamelCase      :	Optional[int]						=       TFAutoModelWithLMHead.from_pretrained(__a					,   from_pt=__a	)
        self.assertIsInstance(__a					,   __a	)
        self.assertEqual(model.num_parameters()					,   1_4410	)
        self.assertEqual(model.num_parameters(only_trainable=__a	)					,   1_4410	)

        _UpperCamelCase      :	Any						=       AutoModelWithLMHead.from_pretrained(__a					,   from_tf=__a	)
        self.assertIsInstance(__a					,   __a	)
        self.assertEqual(model.num_parameters()					,   1_4410	)
        self.assertEqual(model.num_parameters(only_trainable=__a	)					,   1_4410	)







"""simple docstring"""


from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
  lowerCamelCase__				  =   input("Enter image url: ").strip()
  print(f"""Downloading image from {url} ...""")
  lowerCamelCase__				  =   BeautifulSoup(requests.get(url).content, "html.parser")
  # The image URL is in the content field of the first meta tag with property og:image
  lowerCamelCase__				  =   soup.find("meta", {"property": "og:image"})["content"]
  lowerCamelCase__				  =   requests.get(image_url).content
  lowerCamelCase__				  =   f"""{datetime.now():%Y-%m-%d_%H:%M:%S}.jpg"""
  with open(file_name, "wb") as fp:
    fp.write(image_data)
  print(f"""Done. Image saved to disk as {file_name}.""")
