Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,8 @@ import time
|
|
38 |
from concurrent.futures import ThreadPoolExecutor
|
39 |
from moviepy import VideoFileClip, vfx, concatenate_videoclips, ImageSequenceClip
|
40 |
|
|
|
|
|
41 |
torch.set_float32_matmul_precision("medium")
|
42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
43 |
|
@@ -192,6 +194,27 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
192 |
|
193 |
bg_type.change(update_visibility, inputs=bg_type, outputs=[color_picker, bg_image, bg_video, video_handling_options])
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
examples = gr.Examples(
|
196 |
[
|
197 |
["rickroll-2sec.mp4", "Video", None, "background.mp4"],
|
@@ -204,6 +227,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
204 |
cache_examples=True,
|
205 |
cache_mode="eager",
|
206 |
)
|
|
|
207 |
|
208 |
submit_button.click(
|
209 |
fn,
|
|
|
38 |
from concurrent.futures import ThreadPoolExecutor
|
39 |
from moviepy import VideoFileClip, vfx, concatenate_videoclips, ImageSequenceClip
|
40 |
|
41 |
+
import pathlib
|
42 |
+
|
43 |
torch.set_float32_matmul_precision("medium")
|
44 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
45 |
|
|
|
194 |
|
195 |
bg_type.change(update_visibility, inputs=bg_type, outputs=[color_picker, bg_image, bg_video, video_handling_options])
|
196 |
|
197 |
+
mp4_l = list(map(str ,pathlib.Path(".").rglob("*.mp4")))
|
198 |
+
req = []
|
199 |
+
for path in mp4_l:
|
200 |
+
req.extend(
|
201 |
+
[
|
202 |
+
[path, "Video", None, "background.mp4"],
|
203 |
+
[path, "Image", "images.webp", None],
|
204 |
+
[path, "Color", None, None],
|
205 |
+
]
|
206 |
+
)
|
207 |
+
|
208 |
+
examples = gr.Examples(
|
209 |
+
req,
|
210 |
+
inputs=[in_video, bg_type, bg_image, bg_video],
|
211 |
+
outputs=[stream_image, out_video, time_textbox],
|
212 |
+
fn=fn,
|
213 |
+
cache_examples=True,
|
214 |
+
cache_mode="eager",
|
215 |
+
)
|
216 |
+
|
217 |
+
'''
|
218 |
examples = gr.Examples(
|
219 |
[
|
220 |
["rickroll-2sec.mp4", "Video", None, "background.mp4"],
|
|
|
227 |
cache_examples=True,
|
228 |
cache_mode="eager",
|
229 |
)
|
230 |
+
'''
|
231 |
|
232 |
submit_button.click(
|
233 |
fn,
|