Spaces:
Paused
Paused
Commit
·
a004021
1
Parent(s):
251f276
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
#
|
| 2 |
import gradio as gr
|
| 3 |
import subprocess as sp
|
| 4 |
import os
|
|
@@ -14,7 +13,7 @@ def run(*args):
|
|
| 14 |
return "Source file does not exist"
|
| 15 |
if not os.path.exists(target):
|
| 16 |
return "Target file does not exist"
|
| 17 |
-
remove_old_directories("./output", num_minutes=
|
| 18 |
filename = os.path.basename(target)
|
| 19 |
os.makedirs(f"./output/{unique_id}",exist_ok=True)
|
| 20 |
output = f"./output/{unique_id}/{filename}"
|
|
@@ -71,7 +70,7 @@ def clear_output(unique_id):
|
|
| 71 |
except Exception as e:
|
| 72 |
return f"An error occurred: {str(e)}"
|
| 73 |
|
| 74 |
-
def remove_old_directories(directory, num_minutes=
|
| 75 |
now = time.time()
|
| 76 |
|
| 77 |
for r, d, f in os.walk(directory):
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess as sp
|
| 3 |
import os
|
|
|
|
| 13 |
return "Source file does not exist"
|
| 14 |
if not os.path.exists(target):
|
| 15 |
return "Target file does not exist"
|
| 16 |
+
remove_old_directories("./output", num_minutes=60)
|
| 17 |
filename = os.path.basename(target)
|
| 18 |
os.makedirs(f"./output/{unique_id}",exist_ok=True)
|
| 19 |
output = f"./output/{unique_id}/{filename}"
|
|
|
|
| 70 |
except Exception as e:
|
| 71 |
return f"An error occurred: {str(e)}"
|
| 72 |
|
| 73 |
+
def remove_old_directories(directory, num_minutes=60):
|
| 74 |
now = time.time()
|
| 75 |
|
| 76 |
for r, d, f in os.walk(directory):
|