
    uki                     0    d Z ddlZddlZddlZdZdefdZy)zMediaPipe Downloading utils.    Nz0https://storage.googleapis.com/mediapipe-assets/
model_pathc                    t         j                  j                  t         j                  j	                  t
              j                  t         j                        dd       }t         j                  j                  ||       }t         j                  j                  |      ryt        | j                  d      d   z   }t        d|z          t        j                  j                  |      5 }t        |d      5 }|j                  dk7  rt        d| z   d	z         t!        j"                  ||       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)
zUDownloads the oss model from Google Cloud Storage if it doesn't exist in the package.N/zDownloading model to wb   zCannot download z from Google Cloud Storage.)ossepjoinpathabspath__file__splitexists_GCS_URL_PREFIXprinturllibrequesturlopenopencodeConnectionErrorshutilcopyfileobj)r   mp_root_pathmodel_abspath	model_urlresponseout_files         d/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/mediapipe/python/solutions/download_utils.pydownload_oss_modelr"      s    RWW__X6<<RVVDSbIJ,'',,|Z8-WW^^M"

 0 0 5b 99)-/0~~i( +Hd=;?7A +DL}}.;9: ; ;
x*+ + + + + +s$   )E
67D>-E
>E	E

E)__doc__r
   r   urllib.requestr   r   strr"        r!   <module>r(      s$    # 	  D+3 +r'   