fffiloni commited on
Commit
261124f
1 Parent(s): ca8a86f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -1
app.py CHANGED
@@ -7,7 +7,47 @@ def execute_command(command: str) -> None:
7
  subprocess.run(command, check=True)
8
 
9
 
10
- def infer(video_frames, masks_frames):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  video_frames_folder = "inputs/object_removal/bmx-trees"
13
  masks_folder = "inputs/object_removal/bmx-trees_mask"
 
7
  subprocess.run(command, check=True)
8
 
9
 
10
+ def infer(video_frames, masks_frames, project_name):
11
+
12
+
13
+ # Create the directory if it doesn't exist
14
+ my_video_directory = f"{project_name}"
15
+ if not os.path.exists(my_video_directory):
16
+ os.makedirs(my_video_directory)
17
+
18
+ # Assuming 'images' is a list of image file paths
19
+ for idx, image in enumerate(video_frames):
20
+ # Get the base file name (without path) from the original location
21
+ image_name = os.path.basename(image.name)
22
+
23
+ # Construct the destination path in the working directory
24
+ destination_path = os.path.join(my_video_directory, image_name)
25
+
26
+ # Copy the image from the original location to the working directory
27
+ shutil.copy(image.name, destination_path)
28
+
29
+ # Print the image name and its corresponding save path
30
+ print(f"Image {idx + 1}: {image_name} copied to {destination_path}")
31
+
32
+
33
+ # Create the directory if it doesn't exist
34
+ my_masks_directory = f"{project_name}_masks"
35
+ if not os.path.exists(my_masks_directory):
36
+ os.makedirs(my_masks_directory)
37
+
38
+ # Assuming 'images' is a list of image file paths
39
+ for idx, image in enumerate(video_frames):
40
+ # Get the base file name (without path) from the original location
41
+ image_name = os.path.basename(image.name)
42
+
43
+ # Construct the destination path in the working directory
44
+ destination_path = os.path.join(my_masks_directory, image_name)
45
+
46
+ # Copy the image from the original location to the working directory
47
+ shutil.copy(image.name, destination_path)
48
+
49
+ # Print the image name and its corresponding save path
50
+ print(f"Image {idx + 1}: {image_name} copied to {destination_path}")
51
 
52
  video_frames_folder = "inputs/object_removal/bmx-trees"
53
  masks_folder = "inputs/object_removal/bmx-trees_mask"