pcuenq HF staff commited on
Commit
8d4ed6d
1 Parent(s): af46da6

Fix cache removal

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -31,14 +31,13 @@ def clear_hf_cache_space():
31
  to_delete = []
32
  for repo in scan.repos:
33
  if repo.repo_type == "model":
34
- to_delete.append([rev.commit_hash for rev in repo.revisions])
35
 
36
- scan.delete_revisions(to_delete)
37
 
38
  print("Cache has been cleared")
39
 
40
  def upload_to_hub(path, upload_repo, hf_path, token):
41
-
42
  card = ModelCard.load(hf_path)
43
  card.data.tags = ["mlx"] if card.data.tags is None else card.data.tags + ["mlx"]
44
  card.data.base_model = hf_path
 
31
  to_delete = []
32
  for repo in scan.repos:
33
  if repo.repo_type == "model":
34
+ to_delete.extend([rev.commit_hash for rev in repo.revisions])
35
 
36
+ scan.delete_revisions(*to_delete).execute()
37
 
38
  print("Cache has been cleared")
39
 
40
  def upload_to_hub(path, upload_repo, hf_path, token):
 
41
  card = ModelCard.load(hf_path)
42
  card.data.tags = ["mlx"] if card.data.tags is None else card.data.tags + ["mlx"]
43
  card.data.base_model = hf_path