freealise commited on
Commit
71afec8
1 Parent(s): c39bb40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -89,11 +89,14 @@ def create_video(frames, fps, type):
89
  return type + "_result.mp4"
90
 
91
 
92
- def infer(video_in,interpolation,fps_output):
93
 
94
 
95
  # 1. break video into frames and get FPS
96
- break_vid = get_frames(video_in, "vid_input_frame", "origin")
 
 
 
97
  frames_list= break_vid[0]
98
  fps = break_vid[1]
99
  print(f"ORIGIN FPS: {fps}")
@@ -159,8 +162,8 @@ with gr.Blocks() as demo:
159
  gr.HTML(title)
160
  with gr.Row():
161
  with gr.Column():
162
- #video_input = gr.Video(source="upload", type="filepath")
163
- video_input = gr.Textbox(value="./examples/no_framerate.mp4")
164
  with gr.Row():
165
  interpolation = gr.Slider(minimum=1,maximum=4,step=1, value=1, label="Interpolation Steps")
166
  fps_output = gr.Radio([8, 12, 24], label="FPS output", value=8)
@@ -173,11 +176,11 @@ with gr.Blocks() as demo:
173
  gr.Examples(
174
  examples=[["./examples/no_framerate.mp4", 1, 8]],
175
  fn=infer,
176
- inputs=[video_input,interpolation,fps_output],
177
  outputs=[video_output,file_output],
178
  cache_examples=True
179
  )
180
 
181
- submit_btn.click(fn=infer, inputs=[video_input,interpolation,fps_output], outputs=[video_output, file_output])
182
 
183
  demo.launch()
 
89
  return type + "_result.mp4"
90
 
91
 
92
+ def infer(url_in,video_in,interpolation,fps_output):
93
 
94
 
95
  # 1. break video into frames and get FPS
96
+ if url_in.value == "":
97
+ break_vid = get_frames(video_in, "vid_input_frame", "origin")
98
+ else:
99
+ break_vid = get_frames(url_in, "vid_input_frame", "origin")
100
  frames_list= break_vid[0]
101
  fps = break_vid[1]
102
  print(f"ORIGIN FPS: {fps}")
 
162
  gr.HTML(title)
163
  with gr.Row():
164
  with gr.Column():
165
+ video_input = gr.Video(source="upload", type="filepath")
166
+ url_input = gr.Textbox(value="./examples/no_framerate.mp4")
167
  with gr.Row():
168
  interpolation = gr.Slider(minimum=1,maximum=4,step=1, value=1, label="Interpolation Steps")
169
  fps_output = gr.Radio([8, 12, 24], label="FPS output", value=8)
 
176
  gr.Examples(
177
  examples=[["./examples/no_framerate.mp4", 1, 8]],
178
  fn=infer,
179
+ inputs=[url_input,video_input,interpolation,fps_output],
180
  outputs=[video_output,file_output],
181
  cache_examples=True
182
  )
183
 
184
+ submit_btn.click(fn=infer, inputs=[url_input,video_input,interpolation,fps_output], outputs=[video_output, file_output])
185
 
186
  demo.launch()