Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ def get_frames(video_in):
|
|
| 19 |
cap= cv2.VideoCapture("video_resized.mp4")
|
| 20 |
|
| 21 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
|
|
|
| 22 |
i=0
|
| 23 |
while(cap.isOpened()):
|
| 24 |
ret, frame = cap.read()
|
|
@@ -49,6 +50,7 @@ def infer(prompt,video_in, seed_in, trim_value):
|
|
| 49 |
fps = break_vid[1]
|
| 50 |
n_frame = int(trim_value*fps)
|
| 51 |
if n_frame >= len(frames_list):
|
|
|
|
| 52 |
n_frame = len(frames_list)
|
| 53 |
result_frames = []
|
| 54 |
print("set stop frames to: " + str(n_frame))
|
|
@@ -102,7 +104,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 102 |
video_inp = gr.Video(label="Video source", source="upload", type="filepath")
|
| 103 |
with gr.Row():
|
| 104 |
seed_inp = gr.Slider(minimum=0, maximum=10000, step=1, value=123456)
|
| 105 |
-
trim_in = gr.Slider(label="Cut video at (s)", minimun=
|
| 106 |
with gr.Column():
|
| 107 |
|
| 108 |
video_out = gr.Video(label="Pix2pix video result")
|
|
|
|
| 19 |
cap= cv2.VideoCapture("video_resized.mp4")
|
| 20 |
|
| 21 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 22 |
+
print("video fps: " + str(fps))
|
| 23 |
i=0
|
| 24 |
while(cap.isOpened()):
|
| 25 |
ret, frame = cap.read()
|
|
|
|
| 50 |
fps = break_vid[1]
|
| 51 |
n_frame = int(trim_value*fps)
|
| 52 |
if n_frame >= len(frames_list):
|
| 53 |
+
print("video is shorter than the cut value")
|
| 54 |
n_frame = len(frames_list)
|
| 55 |
result_frames = []
|
| 56 |
print("set stop frames to: " + str(n_frame))
|
|
|
|
| 104 |
video_inp = gr.Video(label="Video source", source="upload", type="filepath")
|
| 105 |
with gr.Row():
|
| 106 |
seed_inp = gr.Slider(minimum=0, maximum=10000, step=1, value=123456)
|
| 107 |
+
trim_in = gr.Slider(label="Cut video at (s)", minimun=1, maximum=3, step=1, value=1)
|
| 108 |
with gr.Column():
|
| 109 |
|
| 110 |
video_out = gr.Video(label="Pix2pix video result")
|