






from manim import *
class        a       (					lowercase__  ):



      """simple docstring"""


      def       UpperCAmelCase ( self   :     List[Any]   )				-> List[str]:
        __UpperCAmelCase				:      List[Any]	 =    Rectangle(height=0.5						, width=0.5   )
        __UpperCAmelCase				:      List[Any]	 =    Rectangle(height=0.25						, width=0.25   )
        __UpperCAmelCase				:      Optional[Any]	 =    Rectangle(height=0.46						, width=0.46   ).set_stroke(width=0   )

        __UpperCAmelCase				:      Any	 =    [mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      str	 =    [mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      Optional[int]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      List[str]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      List[Any]	 =    VGroup(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      List[str]	 =    Text("""CPU"""						, font_size=24   )
        __UpperCAmelCase				:      List[Any]	 =    Group(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0.5						, aligned_edge=__lowercase   )
        cpu.move_to([-2.5, -0.5, 0]   )
        self.add(__lowercase   )

        __UpperCAmelCase				:      Tuple	 =    [mem.copy() for i in range(4   )]
        __UpperCAmelCase				:      Any	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      Union[str, Any]	 =    Text("""GPU"""						, font_size=24   )
        __UpperCAmelCase				:      str	 =    Group(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0.5						, aligned_edge=__lowercase   )
        gpu.move_to([-1, -1, 0]   )
        self.add(__lowercase   )

        __UpperCAmelCase				:      List[Any]	 =    [mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      List[Any]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )

        __UpperCAmelCase				:      Union[str, Any]	 =    Text("""Model"""						, font_size=24   )
        __UpperCAmelCase				:      Optional[int]	 =    Group(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0.5						, aligned_edge=__lowercase   )
        model.move_to([3, -1.0, 0]   )
        self.add(__lowercase   )

        __UpperCAmelCase				:      Tuple	 =    []
        __UpperCAmelCase				:      str	 =    []
        __UpperCAmelCase				:      List[Any]	 =    []

        for i, rect in enumerate(__lowercase   ):
          rect.set_stroke(__lowercase   )

          __UpperCAmelCase				:      List[Any]	 =    Rectangle(height=0.46 / 4						, width=0.46 / 3   ).set_stroke(width=0.0   ).set_fill(__lowercase						, opacity=0.7   )

          if i == 0:
            cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT   )						, buff=0.02						, direction=__lowercase   )
            cpu_target.set_x(cpu_target.get_x() + 0.1   )
          elif i == 3:
            cpu_target.next_to(model_cpu_arr[0]						, direction=__lowercase						, buff=0.0   )
          else:
            cpu_target.next_to(model_cpu_arr[i - 1]						, direction=__lowercase						, buff=0.0   )
          self.add(__lowercase   )
          model_cpu_arr.append(__lowercase   )

        self.add(*__lowercase						, *__lowercase						, *__lowercase   )

        __UpperCAmelCase				:      Optional[int]	 =    [mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      List[Any]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )

        __UpperCAmelCase				:      Optional[Any]	 =    Text("""Loaded Checkpoint"""						, font_size=24   )
        __UpperCAmelCase				:      List[Any]	 =    Group(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0.5						, aligned_edge=__lowercase   )
        checkpoint.move_to([3, 0.5, 0]   )

        self.add(__lowercase   )

        __UpperCAmelCase				:      int	 =    []
        __UpperCAmelCase				:      Optional[int]	 =    []

        for i, rect in enumerate(__lowercase   ):
          __UpperCAmelCase				:      Dict	 =    fill.copy().set_fill(__lowercase						, opacity=0.7   )
          target.move_to(__lowercase   )
          ckpt_arr.append(__lowercase   )

          __UpperCAmelCase				:      Optional[Any]	 =    target.copy()
          if i < 5:
            cpu_target.move_to(cpu_left_col_base[i + 1]   )
          else:
            cpu_target.move_to(cpu_right_col_base[i - 5]   )
          ckpt_cpu_arr.append(__lowercase   )
        self.add(*__lowercase						, *__lowercase   )

        __UpperCAmelCase				:      Union[str, Any]	 =    Square(side_length=2.2   )
        key.move_to([-5, 2, 0]   )

        __UpperCAmelCase				:      Optional[Any]	 =    MarkupText(
            f"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""						, font_size=18						, )

        key_text.move_to([-5, 2.4, 0]   )

        self.add(__lowercase						, __lowercase   )

        __UpperCAmelCase				:      List[Any]	 =    MarkupText(
            f"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""						, font_size=18						, )

        blue_text.next_to(__lowercase						, DOWN * 2.4						, aligned_edge=key_text.get_left()   )
        self.add(__lowercase   )

        __UpperCAmelCase				:      Union[str, Any]	 =    MarkupText(
            f"""Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device."""						, font_size=24						, )
        step_a.move_to([2, 2, 0]   )

        __UpperCAmelCase				:      List[str]	 =    [meta_mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      List[str]	 =    [meta_mem.copy() for i in range(6   )]
        __UpperCAmelCase				:      Optional[int]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      Union[str, Any]	 =    VGroup(*__lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      Tuple	 =    VGroup(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0   )
        __UpperCAmelCase				:      Tuple	 =    Text("""Disk"""						, font_size=24   )
        __UpperCAmelCase				:      str	 =    Group(__lowercase						, __lowercase   ).arrange(__lowercase						, buff=0.5						, aligned_edge=__lowercase   )
        disk.move_to([-4.0, -1.25, 0]   )
        self.play(Write(__lowercase						, run_time=3   )						, Write(__lowercase						, run_time=1   )						, Create(__lowercase						, run_time=1   )   )

        __UpperCAmelCase				:      List[Any]	 =    []
        for i, rect in enumerate(__lowercase   ):
          __UpperCAmelCase				:      Any	 =    rect.copy()
          target.generate_target()
          target.target.move_to(disk_left_col_base[i]   ).scale(0.5   )
          animations.append(MoveToTarget(__lowercase						, run_time=1.5   )   )
        self.play(*__lowercase   )

        self.play(FadeOut(__lowercase   )   )

        __UpperCAmelCase				:      Tuple	 =    MarkupText(f"""Then, the checkpoint is removed from memory\nthrough garbage collection."""						, font_size=24   )
        step_a.move_to([2, 2, 0]   )

        self.play(Write(__lowercase						, run_time=3   )   )

        self.play(
            FadeOut(__lowercase						, __lowercase						, *__lowercase						, *__lowercase   )						, )

        self.wait()



from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
     _SCREAMING_SNAKE_CASE 		=      input("""Enter image url: """).strip()
     print(F'''Downloading image from {url} ...''')
     _SCREAMING_SNAKE_CASE 		=      BeautifulSoup(requests.get(url).content, """html.parser""")
     # The image URL is in the content field of the first meta tag with property og:image
     _SCREAMING_SNAKE_CASE 		=      soup.find("""meta""", {"""property""": """og:image"""})["""content"""]
     _SCREAMING_SNAKE_CASE 		=      requests.get(image_url).content
     _SCREAMING_SNAKE_CASE 		=      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}.''')
