Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,18 @@ import PyPDF2
|
|
15 |
import traceback
|
16 |
import os
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Enable persistent caching on Hugging Face Spaces (if persistent storage is enabled)
|
19 |
os.environ["TRANSFORMERS_CACHE"] = "/data/models"
|
20 |
|
|
|
15 |
import traceback
|
16 |
import os
|
17 |
|
18 |
+
import shutil
|
19 |
+
from pathlib import Path
|
20 |
+
|
21 |
+
model_subdir = Path.home() / ".cache" / "huggingface" / "hub" / "models--unsloth--Llama-3.2-3B"
|
22 |
+
|
23 |
+
if model_subdir.exists():
|
24 |
+
print(f"🧹 Deleting model cache at {model_subdir}")
|
25 |
+
shutil.rmtree(model_subdir)
|
26 |
+
print("✅ Model removed.")
|
27 |
+
else:
|
28 |
+
print("⚠️ Specified model not found in cache.")
|
29 |
+
|
30 |
# Enable persistent caching on Hugging Face Spaces (if persistent storage is enabled)
|
31 |
os.environ["TRANSFORMERS_CACHE"] = "/data/models"
|
32 |
|