Spaces:
Paused
Paused
differenciate projects if same name
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import shutil
|
| 3 |
import subprocess
|
| 4 |
import cv2
|
|
@@ -22,6 +23,11 @@ def infer(video_frames, masks_frames, project_name):
|
|
| 22 |
my_video_directory = f"{project_name}"
|
| 23 |
if not os.path.exists(my_video_directory):
|
| 24 |
os.makedirs(my_video_directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Assuming 'images' is a list of image file paths
|
| 27 |
for idx, image in enumerate(video_frames):
|
|
@@ -180,6 +186,11 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
| 180 |
my_video_directory = f"{project_name}"
|
| 181 |
if not os.path.exists(my_video_directory):
|
| 182 |
os.makedirs(my_video_directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
# Assuming 'images' is a list of image file paths
|
| 185 |
for idx, image in enumerate(video_frames[0]):
|
|
|
|
| 1 |
import os
|
| 2 |
+
import datetime
|
| 3 |
import shutil
|
| 4 |
import subprocess
|
| 5 |
import cv2
|
|
|
|
| 23 |
my_video_directory = f"{project_name}"
|
| 24 |
if not os.path.exists(my_video_directory):
|
| 25 |
os.makedirs(my_video_directory)
|
| 26 |
+
else:
|
| 27 |
+
# If the directory already exists, add a timestamp to the new directory name
|
| 28 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
| 29 |
+
my_video_directory = f"{project_name}_{timestamp}"
|
| 30 |
+
os.makedirs(my_video_directory)
|
| 31 |
|
| 32 |
# Assuming 'images' is a list of image file paths
|
| 33 |
for idx, image in enumerate(video_frames):
|
|
|
|
| 186 |
my_video_directory = f"{project_name}"
|
| 187 |
if not os.path.exists(my_video_directory):
|
| 188 |
os.makedirs(my_video_directory)
|
| 189 |
+
else:
|
| 190 |
+
# If the directory already exists, add a timestamp to the new directory name
|
| 191 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
| 192 |
+
my_video_directory = f"{project_name}_{timestamp}"
|
| 193 |
+
os.makedirs(my_video_directory)
|
| 194 |
|
| 195 |
# Assuming 'images' is a list of image file paths
|
| 196 |
for idx, image in enumerate(video_frames[0]):
|