Spaces:
Running
Running
Aitron Emper
commited on
Commit
•
b9e3c01
1
Parent(s):
4e0d992
Upload delete_models.py
Browse files- assets/delete_models.py +30 -0
assets/delete_models.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
import os
|
3 |
+
import time
|
4 |
+
import threading
|
5 |
+
import shutil
|
6 |
+
|
7 |
+
now_dir = os.getcwd()
|
8 |
+
sys.path.append(now_dir)
|
9 |
+
|
10 |
+
|
11 |
+
def infinite_loop():
|
12 |
+
while True:
|
13 |
+
try:
|
14 |
+
models_folder = os.path.join(now_dir, "logs")
|
15 |
+
|
16 |
+
for element in os.listdir(models_folder):
|
17 |
+
element_route = os.path.join(models_folder, element)
|
18 |
+
if os.path.isdir(element_route) and element != "mute":
|
19 |
+
shutil.rmtree(element_route)
|
20 |
+
elif os.path.isfile(element_route):
|
21 |
+
os.remove(element_route)
|
22 |
+
|
23 |
+
wait_time = 24 * 60 * 60 #
|
24 |
+
time.sleep(wait_time)
|
25 |
+
except:
|
26 |
+
pass
|
27 |
+
|
28 |
+
def start_infinite_loop():
|
29 |
+
hilo_bucle = threading.Thread(target=infinite_loop)
|
30 |
+
hilo_bucle.start()
|