Spaces:
Running
Running
Fix cache removal
Browse files
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.
|
| 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
|