Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,13 +43,9 @@ def fn(vid, fps, color):
|
|
43 |
processed_frames_changed_bg = []
|
44 |
for frame in frames:
|
45 |
pil_image = Image.fromarray(frame)
|
46 |
-
processed_image, mask = process(pil_image, color)
|
47 |
-
processed_frames_no_bg.append(np.array(
|
48 |
-
|
49 |
-
# Compose with background for changed background video
|
50 |
-
background = Image.new("RGBA", pil_image.size, color + str((255,)))
|
51 |
-
composed_image = Image.composite(pil_image, background, mask)
|
52 |
-
processed_frames_changed_bg.append(np.array(composed_image))
|
53 |
|
54 |
# Create a new video from the processed frames
|
55 |
processed_video = mp.ImageSequenceClip(processed_frames_changed_bg, fps=fps)
|
|
|
43 |
processed_frames_changed_bg = []
|
44 |
for frame in frames:
|
45 |
pil_image = Image.fromarray(frame)
|
46 |
+
processed_image, mask = process(pil_image, color)
|
47 |
+
processed_frames_no_bg.append(np.array(mask))
|
48 |
+
processed_frames_changed_bg.append(np.array(processed_image))
|
|
|
|
|
|
|
|
|
49 |
|
50 |
# Create a new video from the processed frames
|
51 |
processed_video = mp.ImageSequenceClip(processed_frames_changed_bg, fps=fps)
|