fffiloni commited on
Commit
91dc1c2
1 Parent(s): de4481e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -91,8 +91,8 @@ def infer(video_in,interpolation,fps_output):
91
  break_vid = get_frames(video_in, "vid_input_frame")
92
  frames_list= break_vid[0]
93
  fps = break_vid[1]
94
- #n_frame = int(trim_value*fps)
95
- n_frame = len(frames_list)
96
 
97
  if n_frame >= len(frames_list):
98
  print("video is shorter than the cut value")
@@ -119,7 +119,7 @@ def infer(video_in,interpolation,fps_output):
119
 
120
  final_vid = create_video(result_frames, fps_output, "interpolated")
121
 
122
- files = [final_vid]
123
 
124
  return final_vid, files
125
 
@@ -139,7 +139,8 @@ title="""
139
  </h1>
140
 
141
  </div>
142
- <p> - </p>
 
143
  </div>
144
  """
145
 
@@ -149,21 +150,22 @@ with gr.Blocks() as demo:
149
  with gr.Row():
150
  with gr.Column():
151
  video_input = gr.Video(source="upload", type="filepath")
152
- interpolation = gr.Slider(minimum=2,maximum=4,step=1, value=1, label="Interpolation Steps")
153
- fps_output = gr.Radio([8, 12, 24], label="FPS output", value=8)
 
154
  submit_btn = gr.Button("Submit")
155
 
156
  with gr.Column():
157
  video_output = gr.Video()
158
- file_output = gr.Files()
159
-
160
- #gr.Examples(
161
- #examples=["./examples/childishgambino.mp4", "./examples/jimmyfallon.mp4"],
162
- #fn=infer,
163
- #inputs=[video_input],
164
- #outputs=[video_output,file_output],
165
- #cache_examples=False
166
- #)
167
 
168
  submit_btn.click(fn=infer, inputs=[video_input,interpolation,fps_output], outputs=[video_output, file_output])
169
 
 
91
  break_vid = get_frames(video_in, "vid_input_frame")
92
  frames_list= break_vid[0]
93
  fps = break_vid[1]
94
+ n_frame = int(4*fps) #limited to 4 seconds
95
+ #n_frame = len(frames_list)
96
 
97
  if n_frame >= len(frames_list):
98
  print("video is shorter than the cut value")
 
119
 
120
  final_vid = create_video(result_frames, fps_output, "interpolated")
121
 
122
+ files = final_vid
123
 
124
  return final_vid, files
125
 
 
139
  </h1>
140
 
141
  </div>
142
+ <p> This space uses FILM to generate interpolation frames in a video you need to fluidify.<br />
143
+ Generation is limited to 4 seconds, from the beginning of your video input.</p>
144
  </div>
145
  """
146
 
 
150
  with gr.Row():
151
  with gr.Column():
152
  video_input = gr.Video(source="upload", type="filepath")
153
+ with gr.Row():
154
+ interpolation = gr.Slider(minimum=2,maximum=4,step=1, value=2, label="Interpolation Steps")
155
+ fps_output = gr.Radio([8, 12, 24], label="FPS output", value=8)
156
  submit_btn = gr.Button("Submit")
157
 
158
  with gr.Column():
159
  video_output = gr.Video()
160
+ file_output = gr.File()
161
+
162
+ gr.Examples(
163
+ examples=["./yoda-fps2.mp4", 2, 12],
164
+ fn=infer,
165
+ inputs=[video_input],
166
+ outputs=[video_output,file_output],
167
+ cache_examples=True
168
+ )
169
 
170
  submit_btn.click(fn=infer, inputs=[video_input,interpolation,fps_output], outputs=[video_output, file_output])
171