Spaces:
Sleeping
Sleeping
Commit ·
6b45962
1
Parent(s): d14d520
Force cache clear on app startup to ensure fresh module loading
Browse files- app.py +9 -1
- clear_cache.py +17 -0
app.py
CHANGED
|
@@ -3,10 +3,18 @@
|
|
| 3 |
IPAD VAD Training Interface on HuggingFace Spaces with ZeroGPU
|
| 4 |
Updated version with integrated training infrastructure
|
| 5 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
import torch
|
| 8 |
import os
|
| 9 |
-
from pathlib import Path
|
| 10 |
import json
|
| 11 |
from datetime import datetime
|
| 12 |
import zipfile
|
|
|
|
| 3 |
IPAD VAD Training Interface on HuggingFace Spaces with ZeroGPU
|
| 4 |
Updated version with integrated training infrastructure
|
| 5 |
"""
|
| 6 |
+
# IMPORTANT: Clear Python cache first to avoid loading stale modules
|
| 7 |
+
import shutil
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
for pycache in Path('.').rglob('__pycache__'):
|
| 10 |
+
shutil.rmtree(pycache, ignore_errors=True)
|
| 11 |
+
for pyc in Path('.').rglob('*.pyc'):
|
| 12 |
+
pyc.unlink(missing_ok=True)
|
| 13 |
+
print("🧹 Cache cleared - loading fresh modules")
|
| 14 |
+
|
| 15 |
import gradio as gr
|
| 16 |
import torch
|
| 17 |
import os
|
|
|
|
| 18 |
import json
|
| 19 |
from datetime import datetime
|
| 20 |
import zipfile
|
clear_cache.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Clear Python cache before starting app"""
|
| 3 |
+
import os
|
| 4 |
+
import shutil
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
# Clear all __pycache__ directories
|
| 8 |
+
for pycache in Path('.').rglob('__pycache__'):
|
| 9 |
+
print(f"Removing {pycache}")
|
| 10 |
+
shutil.rmtree(pycache, ignore_errors=True)
|
| 11 |
+
|
| 12 |
+
# Clear .pyc files
|
| 13 |
+
for pyc in Path('.').rglob('*.pyc'):
|
| 14 |
+
print(f"Removing {pyc}")
|
| 15 |
+
pyc.unlink(missing_ok=True)
|
| 16 |
+
|
| 17 |
+
print("✅ Cache cleared!")
|