Spaces:
Running
on
Zero
Running
on
Zero
Update app.py (#1)
Browse files- Update app.py (bcece853515041b766feb5e15ddcd879992969d3)
app.py
CHANGED
@@ -28,10 +28,14 @@ transform_image = transforms.Compose(
|
|
28 |
|
29 |
|
30 |
@spaces.GPU
|
31 |
-
def fn(vid, fps=
|
32 |
# Load the video using moviepy
|
33 |
video = mp.VideoFileClip(vid)
|
34 |
|
|
|
|
|
|
|
|
|
35 |
# Extract audio from the video
|
36 |
audio = video.audio
|
37 |
|
@@ -94,7 +98,7 @@ with gr.Blocks() as demo:
|
|
94 |
out_video = gr.Video(label="Final Output Video")
|
95 |
submit_button = gr.Button("Change Background")
|
96 |
with gr.Row():
|
97 |
-
fps_slider = gr.Slider(minimum=
|
98 |
color_picker = gr.ColorPicker(label="Background Color", value="#00FF00")
|
99 |
|
100 |
examples = gr.Examples(["rickroll-2sec.mp4"], inputs=in_video, outputs=[stream_image, out_video], fn=fn, cache_examples=True, cache_mode="eager")
|
|
|
28 |
|
29 |
|
30 |
@spaces.GPU
|
31 |
+
def fn(vid, fps=0, color="#00FF00"):
|
32 |
# Load the video using moviepy
|
33 |
video = mp.VideoFileClip(vid)
|
34 |
|
35 |
+
# Load original fps if fps value is equal to 0
|
36 |
+
if fps == 0:
|
37 |
+
fps = video.fps
|
38 |
+
|
39 |
# Extract audio from the video
|
40 |
audio = video.audio
|
41 |
|
|
|
98 |
out_video = gr.Video(label="Final Output Video")
|
99 |
submit_button = gr.Button("Change Background")
|
100 |
with gr.Row():
|
101 |
+
fps_slider = gr.Slider(minimum=0, maximum=60, step=1, value=0, label="Output FPS (0 will inherit the original fps value)")
|
102 |
color_picker = gr.ColorPicker(label="Background Color", value="#00FF00")
|
103 |
|
104 |
examples = gr.Examples(["rickroll-2sec.mp4"], inputs=in_video, outputs=[stream_image, out_video], fn=fn, cache_examples=True, cache_mode="eager")
|