Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,8 +62,12 @@ def inference_image(image, size):
|
|
| 62 |
def inference_video(video, size):
|
| 63 |
_id = randint(1, 10000)
|
| 64 |
INPUT_DIR = "tmp/" + str(_id)
|
| 65 |
-
|
| 66 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
os.system(f"cd {INPUT_DIR}")
|
| 68 |
upload_folder = 'upload'
|
| 69 |
result_folder = 'results'
|
|
|
|
| 62 |
def inference_video(video, size):
|
| 63 |
_id = randint(1, 10000)
|
| 64 |
INPUT_DIR = "tmp/" + str(_id)
|
| 65 |
+
# Check if the directory exists, if so remove it
|
| 66 |
+
if os.path.exists(INPUT_DIR):
|
| 67 |
+
shutil.rmtree(INPUT_DIR)
|
| 68 |
+
else:
|
| 69 |
+
# Create the directory, equivalent to 'mkdir -p'
|
| 70 |
+
os.makedirs(INPUT_DIR, exist_ok=True)
|
| 71 |
os.system(f"cd {INPUT_DIR}")
|
| 72 |
upload_folder = 'upload'
|
| 73 |
result_folder = 'results'
|