



import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand




def       __lowerCAmelCase      (						A_   : Any					)    ->  Optional[Any]:
  return EnvironmentCommand()





class 			UpperCAmelCase__    (		__lowercase					):



  """simple docstring"""






  @staticmethod
  def 	_UpperCAmelCase				(				__lowerCAmelCase:			ArgumentParser   ) -> Optional[Any]:




    '''simple docstring'''




    __UpperCAmelCase						    =       parser.add_parser("env"   )
    download_parser.set_defaults(func=__a   )






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




    '''simple docstring'''




    __UpperCAmelCase						    =       huggingface_hub.__version__

    __UpperCAmelCase						    =       """not installed"""
    __UpperCAmelCase						    =       """NA"""
    if is_torch_available():
      import torch

      __UpperCAmelCase						    =       torch.__version__
      __UpperCAmelCase						    =       torch.cuda.is_available()

    __UpperCAmelCase						    =       """not installed"""
    if is_transformers_available():
      import transformers

      __UpperCAmelCase						    =       transformers.__version__

    __UpperCAmelCase						    =       """not installed"""
    if is_accelerate_available():
      import accelerate

      __UpperCAmelCase						    =       accelerate.__version__

    __UpperCAmelCase						    =       """not installed"""
    if is_xformers_available():
      import xformers

      __UpperCAmelCase						    =       xformers.__version__

    __UpperCAmelCase						    =       {
        """`diffusers` version""": version,
        """Platform""": platform.platform(),
        """Python version""": platform.python_version(),
        """PyTorch version (GPU?)""": F'''{pt_version} ({pt_cuda_available})''',
        """Huggingface_hub version""": hub_version,
        """Transformers version""": transformers_version,
        """Accelerate version""": accelerate_version,
        """xFormers version""": xformers_version,
        """Using GPU in script?""": """<fill in>""",
        """Using distributed or parallel set-up in script?""": """<fill in>""",
    }

    print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n"   )
    print(self.format_dict(__a   )   )

    return info






  @staticmethod
  def 	_UpperCAmelCase				(				__lowerCAmelCase:			int   ) -> Optional[Any]:




    '''simple docstring'''




    return "\n".join([F'''- {prop}: {val}''' for prop, val in d.items()]   ) + "\n"




from datetime import datetime

import requests




def       __lowerCAmelCase      (						A_   : str					)    ->  bytes:
  __UpperCAmelCase						    =       "https://downloadgram.net/wp-json/wppress/video-downloader/video?url="
  __UpperCAmelCase						    =       requests.get(base_url + url					).json()[0]["urls"][0]["src"]
  return requests.get(A_					).content


if __name__ == "__main__":
       a_							=      input("""Enter Video/IGTV url: """).strip()
       a_							=      F"{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4"
       with open(file_name, """wb""") as fp:
              fp.write(download_video(url))
       print(F"Done. Video saved to disk as {file_name}.")



