deepyuna commited on
Commit
ed0aef7
·
verified ·
1 Parent(s): 99f644d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -26,13 +26,20 @@ REPO_ID = f"{USER_NAME}/{PRIVATE_SPACE_NAME}"
26
  REPO_TYPE = "space"
27
 
28
  # sys.path.append(repo_dir)
29
-
 
 
 
 
 
 
 
30
  # Download the entire space, including the fine-tuned model folder
31
  repo_dir = snapshot_download(
32
  repo_id=REPO_ID,
33
  repo_type=REPO_TYPE,
34
  token=HF_TOKEN,
35
- cache_dir="private_space_cache",
36
  force_download=True # Forces redownload
37
  )
38
 
 
26
  REPO_TYPE = "space"
27
 
28
  # sys.path.append(repo_dir)
29
+ cache_dir = "private_space_cache"
30
+ if os.path.exists(cache_dir):
31
+ for root, dirs, files in os.walk(cache_dir):
32
+ for file in files:
33
+ if file.endswith(".incomplete"):
34
+ st.warning("🚨 Incomplete cache detected. Clearing cache for stability...")
35
+ shutil.rmtree(cache_dir)
36
+ break # Stop looping once cache is cleared
37
  # Download the entire space, including the fine-tuned model folder
38
  repo_dir = snapshot_download(
39
  repo_id=REPO_ID,
40
  repo_type=REPO_TYPE,
41
  token=HF_TOKEN,
42
+ cache_dir=cache_dir, #"private_space_cache"
43
  force_download=True # Forces redownload
44
  )
45