anonymous commited on
Commit
cee2f21
1 Parent(s): 2896183
Files changed (2) hide show
  1. app.py +5 -5
  2. src/video_util.py +1 -1
app.py CHANGED
@@ -613,7 +613,8 @@ def process2(*args):
613
  DESCRIPTION = '''
614
  ## Rerender A Video
615
  ### This space provides the function of key frame translation. Full code for full video translation will be released upon the publication of the paper.
616
- ### To avoid overload, we set limitations to the maximum frame number and the maximum frame resolution.
 
617
  ### Tips:
618
  1. This method cannot handle large or quick motions where the optical flow is hard to estimate. **Videos with stable motions are preferred**.
619
  2. Pixel-aware fusion may not work for large or quick motions.
@@ -852,10 +853,9 @@ with block:
852
  inner_strength, smooth_boundary
853
  ]
854
 
855
- gr.Examples(
856
- examples=args_list,
857
- inputs=[input_path, *ips],
858
- )
859
 
860
  with gr.Column():
861
  result_image = gr.Image(label='Output first frame',
 
613
  DESCRIPTION = '''
614
  ## Rerender A Video
615
  ### This space provides the function of key frame translation. Full code for full video translation will be released upon the publication of the paper.
616
+ ### To avoid overload, we set limitations to the maximum frame number (8) and the maximum frame resolution (512x768).
617
+ ### The running time of a video of size 512x640 is about 1 minute per keyframe under T4 GPU.
618
  ### Tips:
619
  1. This method cannot handle large or quick motions where the optical flow is hard to estimate. **Videos with stable motions are preferred**.
620
  2. Pixel-aware fusion may not work for large or quick motions.
 
853
  inner_strength, smooth_boundary
854
  ]
855
 
856
+ gr.Examples(examples=args_list,
857
+ inputs=[input_path, *ips],
858
+ cache_examples=True)
 
859
 
860
  with gr.Column():
861
  result_image = gr.Image(label='Output first frame',
src/video_util.py CHANGED
@@ -74,7 +74,7 @@ def resize_image(input_image, resolution):
74
  H, W, C = input_image.shape
75
  H = float(H)
76
  W = float(W)
77
- k = float(resolution) / min(H, W)
78
  H *= k
79
  W *= k
80
  H = int(np.round(H / 64.0)) * 64
 
74
  H, W, C = input_image.shape
75
  H = float(H)
76
  W = float(W)
77
+ k = min(float(resolution) / min(H, W), float(768) / max(H, W))
78
  H *= k
79
  W *= k
80
  H = int(np.round(H / 64.0)) * 64