Spaces:
Sleeping
Sleeping
Delete main_app.py
Browse files- main_app.py +0 -35
main_app.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
import os
|
| 3 |
-
import shutil
|
| 4 |
-
|
| 5 |
-
# SUR HUGGING FACE SPACES, LE BUCKET EST STRICTEMENT "/data"
|
| 6 |
-
HF_BUCKET = "/data"
|
| 7 |
-
|
| 8 |
-
def clear_hf_bucket():
|
| 9 |
-
print(f"🗑️ Cible : {HF_BUCKET}")
|
| 10 |
-
|
| 11 |
-
if not os.path.exists(HF_BUCKET):
|
| 12 |
-
print("⚠️ Le dossier /data n'existe pas (normal si aucune persistance encore).")
|
| 13 |
-
return
|
| 14 |
-
|
| 15 |
-
# On liste ce qu'on va supprimer
|
| 16 |
-
items = os.listdir(HF_BUCKET)
|
| 17 |
-
if not items:
|
| 18 |
-
print("✅ Le bucket est déjà vide.")
|
| 19 |
-
return
|
| 20 |
-
|
| 21 |
-
print(f"📊 Suppression de {len(items)} éléments...")
|
| 22 |
-
for item in items:
|
| 23 |
-
item_path = os.path.join(HF_BUCKET, item)
|
| 24 |
-
try:
|
| 25 |
-
if os.path.isfile(item_path) or os.path.islink(item_path):
|
| 26 |
-
os.remove(item_path)
|
| 27 |
-
elif os.path.isdir(item_path):
|
| 28 |
-
shutil.rmtree(item_path)
|
| 29 |
-
except Exception as e:
|
| 30 |
-
print(f"❌ Erreur avec {item_path} : {e}")
|
| 31 |
-
|
| 32 |
-
print("✅ Bucket /data entièrement vidé !")
|
| 33 |
-
|
| 34 |
-
if __name__ == "__main__":
|
| 35 |
-
clear_hf_bucket()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|