Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -175,10 +175,26 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
175 |
#video_cut = f"video_cut.mp4"
|
176 |
#ffmpeg_extract_subclip(video_in, t1=0, t2=3, targetname=video_cut)
|
177 |
video_frames = get_frames(video_in, "source")
|
|
|
178 |
print(video_frames[0])
|
179 |
|
180 |
masks_frames = get_frames(matte_video, "mask")
|
|
|
181 |
print(masks_frames[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
|
184 |
# Create the directory if it doesn't exist
|
@@ -194,7 +210,7 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
194 |
|
195 |
|
196 |
# Assuming 'images' is a list of image file paths
|
197 |
-
for idx, image in enumerate(
|
198 |
# Get the base file name (without path) from the original location
|
199 |
image_name = os.path.basename(image)
|
200 |
|
@@ -220,7 +236,7 @@ def infer_auto(project_name, video_in, subject_to_remove):
|
|
220 |
print(f"Created the dir: {my_masks_directory}")
|
221 |
|
222 |
# Assuming 'images' is a list of image file paths
|
223 |
-
for idx, image in enumerate(
|
224 |
# Get the base file name (without path) from the original location
|
225 |
image_name = os.path.basename(image)
|
226 |
|
|
|
175 |
#video_cut = f"video_cut.mp4"
|
176 |
#ffmpeg_extract_subclip(video_in, t1=0, t2=3, targetname=video_cut)
|
177 |
video_frames = get_frames(video_in, "source")
|
178 |
+
frames_list = video_frames[0]
|
179 |
print(video_frames[0])
|
180 |
|
181 |
masks_frames = get_frames(matte_video, "mask")
|
182 |
+
masks_list = masks_frames[0]
|
183 |
print(masks_frames[0])
|
184 |
+
|
185 |
+
|
186 |
+
# Check the lengths of the two lists
|
187 |
+
frames_length = len(frames_list)
|
188 |
+
masks_length = len(masks_list)
|
189 |
+
|
190 |
+
# Make the lists the same length if they are different
|
191 |
+
if frames_length > masks_length:
|
192 |
+
frames_list = frames_list[:masks_length]
|
193 |
+
elif masks_length > frames_length:
|
194 |
+
masks_list = masks_list[:frames_length]
|
195 |
+
|
196 |
+
# Now, both lists have the same length
|
197 |
+
|
198 |
|
199 |
|
200 |
# Create the directory if it doesn't exist
|
|
|
210 |
|
211 |
|
212 |
# Assuming 'images' is a list of image file paths
|
213 |
+
for idx, image in enumerate(frames_list):
|
214 |
# Get the base file name (without path) from the original location
|
215 |
image_name = os.path.basename(image)
|
216 |
|
|
|
236 |
print(f"Created the dir: {my_masks_directory}")
|
237 |
|
238 |
# Assuming 'images' is a list of image file paths
|
239 |
+
for idx, image in enumerate(masks_list):
|
240 |
# Get the base file name (without path) from the original location
|
241 |
image_name = os.path.basename(image)
|
242 |
|