Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -6,6 +6,23 @@ import os
|
|
| 6 |
from pathlib import Path
|
| 7 |
from gradio.flagging import SimpleCSVLogger
|
| 8 |
from utils import GradioConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
class Resnet50Imagenet1kGradioApp:
|
| 11 |
def __init__(self,cfg: GradioConfig):
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from gradio.flagging import SimpleCSVLogger
|
| 8 |
from utils import GradioConfig
|
| 9 |
+
import os
|
| 10 |
+
import sys
|
| 11 |
+
|
| 12 |
+
print("🧹 Cleaning caches to free disk space...")
|
| 13 |
+
try:
|
| 14 |
+
# Show current usage (optional)
|
| 15 |
+
os.system("du -h --max-depth=1 /")
|
| 16 |
+
|
| 17 |
+
# Delete caches & temp files
|
| 18 |
+
os.system("rm -rf /root/.cache/huggingface")
|
| 19 |
+
os.system("rm -rf /root/.cache/pip")
|
| 20 |
+
os.system("rm -rf /tmp/*")
|
| 21 |
+
sys.stdout.flush()
|
| 22 |
+
except Exception as e:
|
| 23 |
+
print(f"Error cleaning caches: {e}")
|
| 24 |
+
|
| 25 |
+
print("✅ Cleanup done. Continuing startup...")
|
| 26 |
|
| 27 |
class Resnet50Imagenet1kGradioApp:
|
| 28 |
def __init__(self,cfg: GradioConfig):
|