Update app.py
Browse files
app.py
CHANGED
@@ -35,23 +35,23 @@ def do_interpolation(frame1, frame2, times_to_interpolate):
|
|
35 |
input_frames, times_to_interpolate, interpolator))
|
36 |
|
37 |
#print(frames)
|
38 |
-
mediapy.write_video(f"{frame1}_to_{frame2}_out.mp4", frames, fps=
|
39 |
return f"{frame1}_to_{frame2}_out.mp4"
|
40 |
|
41 |
def get_frames(video_in, step, name):
|
42 |
frames = []
|
43 |
-
#resize the video
|
44 |
cap = cv2.VideoCapture(video_in)
|
45 |
cframes = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
46 |
cfps = int(cap.get(cv2.CAP_PROP_FPS))
|
47 |
print(f'frames: {cframes}, fps: {cfps}')
|
48 |
-
|
|
|
49 |
#clip = VideoFileClip(video_in)
|
50 |
|
51 |
#check fps
|
52 |
#if cfps > 25:
|
53 |
# print("video rate is over 25, resetting to 25")
|
54 |
-
# clip_resized = clip
|
55 |
# clip_resized.write_videofile("video_resized.mp4", fps=25)
|
56 |
#else:
|
57 |
# print("video rate is OK")
|
@@ -159,10 +159,10 @@ with gr.Blocks() as demo:
|
|
159 |
gr.HTML(title)
|
160 |
with gr.Row():
|
161 |
with gr.Column():
|
162 |
-
url_input = gr.Textbox(value="./examples/no_framerate.mp4")
|
163 |
with gr.Row():
|
164 |
interpolation = gr.Slider(minimum=1, maximum=24, step=1, value=1, label="Interpolation Steps")
|
165 |
-
fps_output = gr.Radio([6, 12, 24, 25], label="FPS output", value=
|
166 |
submit_btn = gr.Button("Submit")
|
167 |
|
168 |
with gr.Column():
|
@@ -170,7 +170,7 @@ with gr.Blocks() as demo:
|
|
170 |
file_output = gr.File()
|
171 |
|
172 |
gr.Examples(
|
173 |
-
examples=[["./examples/no_framerate.mp4", 1,
|
174 |
fn=infer,
|
175 |
inputs=[url_input,interpolation,fps_output],
|
176 |
outputs=[video_output,file_output],
|
|
|
35 |
input_frames, times_to_interpolate, interpolator))
|
36 |
|
37 |
#print(frames)
|
38 |
+
mediapy.write_video(f"{frame1}_to_{frame2}_out.mp4", frames, fps=1)
|
39 |
return f"{frame1}_to_{frame2}_out.mp4"
|
40 |
|
41 |
def get_frames(video_in, step, name):
|
42 |
frames = []
|
|
|
43 |
cap = cv2.VideoCapture(video_in)
|
44 |
cframes = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
45 |
cfps = int(cap.get(cv2.CAP_PROP_FPS))
|
46 |
print(f'frames: {cframes}, fps: {cfps}')
|
47 |
+
|
48 |
+
#resize the video
|
49 |
#clip = VideoFileClip(video_in)
|
50 |
|
51 |
#check fps
|
52 |
#if cfps > 25:
|
53 |
# print("video rate is over 25, resetting to 25")
|
54 |
+
# clip_resized = clip.resize(height=1024)
|
55 |
# clip_resized.write_videofile("video_resized.mp4", fps=25)
|
56 |
#else:
|
57 |
# print("video rate is OK")
|
|
|
159 |
gr.HTML(title)
|
160 |
with gr.Row():
|
161 |
with gr.Column():
|
162 |
+
url_input = gr.Textbox(value="./examples/no_framerate.mp4", label="URL")
|
163 |
with gr.Row():
|
164 |
interpolation = gr.Slider(minimum=1, maximum=24, step=1, value=1, label="Interpolation Steps")
|
165 |
+
fps_output = gr.Radio([1, 6, 12, 24, 25], label="FPS output", value=1)
|
166 |
submit_btn = gr.Button("Submit")
|
167 |
|
168 |
with gr.Column():
|
|
|
170 |
file_output = gr.File()
|
171 |
|
172 |
gr.Examples(
|
173 |
+
examples=[["./examples/no_framerate.mp4", 1, 1]],
|
174 |
fn=infer,
|
175 |
inputs=[url_input,interpolation,fps_output],
|
176 |
outputs=[video_output,file_output],
|