Spaces:
Runtime error
Runtime error
yourusername
commited on
Commit
•
8e8df9f
1
Parent(s):
dbb2340
:art: add progress
Browse files
app.py
CHANGED
@@ -19,12 +19,19 @@ def run_cmd(command):
|
|
19 |
sys.exit(1)
|
20 |
|
21 |
|
22 |
-
def download_cache(cache_dir: str, repo_name: str):
|
23 |
"""Clones a repo from HuggingFace Hub to a cache directory"""
|
24 |
if os.environ.get("DO_DOWNLOAD_CACHE") and 'cache_is_downloaded' not in st.session_state:
|
25 |
with st.spinner("Downloading cache...this might take a while 😬"):
|
26 |
repo = Repository(local_dir=cache_dir, clone_from=repo_name, repo_type='dataset')
|
27 |
repo.git_pull()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
def main():
|
|
|
19 |
sys.exit(1)
|
20 |
|
21 |
|
22 |
+
def download_cache(cache_dir: str, repo_name: str, wait_for_completion: bool = True):
|
23 |
"""Clones a repo from HuggingFace Hub to a cache directory"""
|
24 |
if os.environ.get("DO_DOWNLOAD_CACHE") and 'cache_is_downloaded' not in st.session_state:
|
25 |
with st.spinner("Downloading cache...this might take a while 😬"):
|
26 |
repo = Repository(local_dir=cache_dir, clone_from=repo_name, repo_type='dataset')
|
27 |
repo.git_pull()
|
28 |
+
if wait_for_completion:
|
29 |
+
placeholder = st.empty()
|
30 |
+
elapsed = 0
|
31 |
+
while os.environ.get("GIT_LFS_PROGRESS"):
|
32 |
+
time.sleep(1)
|
33 |
+
elapsed += 1
|
34 |
+
placeholder.write(f"Been waiting for {elapsed}s")
|
35 |
|
36 |
|
37 |
def main():
|