Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -72,14 +72,11 @@ def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=
|
|
72 |
bg_frame_index += 1
|
73 |
background_image = Image.fromarray(background_frame)
|
74 |
processed_image = process(pil_image, background_image)
|
75 |
-
else:
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
except StopIteration:
|
81 |
-
# Handle case where background video is shorter than input video
|
82 |
-
processed_image = process(pil_image, "#000000") # Default to black background
|
83 |
else:
|
84 |
processed_image = pil_image # Default to original image if no background is selected
|
85 |
|
|
|
72 |
bg_frame_index += 1
|
73 |
background_image = Image.fromarray(background_frame)
|
74 |
processed_image = process(pil_image, background_image)
|
75 |
+
else: # video_handling == "loop"
|
76 |
+
background_frame = background_frames[bg_frame_index % len(background_frames)]
|
77 |
+
bg_frame_index += 1
|
78 |
+
background_image = Image.fromarray(background_frame)
|
79 |
+
processed_image = process(pil_image, background_image)
|
|
|
|
|
|
|
80 |
else:
|
81 |
processed_image = pil_image # Default to original image if no background is selected
|
82 |
|