fffiloni commited on
Commit
821ff96
1 Parent(s): b3ba0ab

fix folder timestamp in manual mode

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -49,6 +49,11 @@ def infer(video_frames, masks_frames, project_name):
49
  my_masks_directory = f"{project_name}_masks"
50
  if not os.path.exists(my_masks_directory):
51
  os.makedirs(my_masks_directory)
 
 
 
 
 
52
 
53
  # Assuming 'images' is a list of image file paths
54
  for idx, image in enumerate(masks_frames):
@@ -71,7 +76,7 @@ def infer(video_frames, masks_frames, project_name):
71
  masks_folder = f"{my_masks_directory}"
72
 
73
  # Create the "results" folder if it doesn't exist
74
- output_folder = "results"
75
  if not os.path.exists(output_folder):
76
  os.makedirs(output_folder)
77
 
 
49
  my_masks_directory = f"{project_name}_masks"
50
  if not os.path.exists(my_masks_directory):
51
  os.makedirs(my_masks_directory)
52
+ else:
53
+ # If the directory already exists, add a timestamp to the new directory name
54
+
55
+ my_masks_directory = f"{project_name}_masks_{timestamp}"
56
+ os.makedirs(my_masks_directory)
57
 
58
  # Assuming 'images' is a list of image file paths
59
  for idx, image in enumerate(masks_frames):
 
76
  masks_folder = f"{my_masks_directory}"
77
 
78
  # Create the "results" folder if it doesn't exist
79
+ output_folder = f"results_{timestamp}"
80
  if not os.path.exists(output_folder):
81
  os.makedirs(output_folder)
82