anonymous commited on
Commit
683473c
1 Parent(s): ce061be
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -620,7 +620,7 @@ def process2(*args):
620
  DESCRIPTION = '''
621
  ## Rerender A Video
622
  ### This space provides the function of key frame translation. Full code for full video translation will be released upon the publication of the paper.
623
- ### To avoid overload, we set limitations to the maximum frame number (8) and the maximum frame resolution (512x768).
624
  ### The running time of a video of size 512x640 is about 1 minute per keyframe under T4 GPU.
625
  ### How to use:
626
  1. **Run 1st Key Frame**: only translate the first frame, so you can adjust the prompts/models/parameters to find your ideal output appearance before run the whole video.
@@ -899,7 +899,7 @@ with block:
899
  global_video_path = path
900
 
901
  return gr.Slider.update(value=default_interval,
902
- maximum=MAX_KEYFRAME), gr.Slider.update(
903
  value=max_keyframe, maximum=max_keyframe)
904
 
905
  def input_changed(path):
@@ -915,7 +915,8 @@ with block:
915
  global global_video_path
916
  global_video_path = path
917
 
918
- return gr.Slider.update(maximum=max_keyframe), \
 
919
  gr.Slider.update(maximum=max_keyframe)
920
 
921
  def interval_changed(interval):
@@ -923,7 +924,7 @@ with block:
923
  if video_frame_count is None:
924
  return gr.Slider.update()
925
 
926
- max_keyframe = (video_frame_count - 2) // interval
927
 
928
  return gr.Slider.update(value=max_keyframe, maximum=max_keyframe)
929
 
 
620
  DESCRIPTION = '''
621
  ## Rerender A Video
622
  ### This space provides the function of key frame translation. Full code for full video translation will be released upon the publication of the paper.
623
+ ### To avoid overload, we set limitations to the **maximum frame number** (8) and the maximum frame resolution (512x768).
624
  ### The running time of a video of size 512x640 is about 1 minute per keyframe under T4 GPU.
625
  ### How to use:
626
  1. **Run 1st Key Frame**: only translate the first frame, so you can adjust the prompts/models/parameters to find your ideal output appearance before run the whole video.
 
899
  global_video_path = path
900
 
901
  return gr.Slider.update(value=default_interval,
902
+ maximum=frame_count - 2), gr.Slider.update(
903
  value=max_keyframe, maximum=max_keyframe)
904
 
905
  def input_changed(path):
 
915
  global global_video_path
916
  global_video_path = path
917
 
918
+ return gr.Slider.update(value=default_interval,
919
+ maximum=frame_count - 2), \
920
  gr.Slider.update(maximum=max_keyframe)
921
 
922
  def interval_changed(interval):
 
924
  if video_frame_count is None:
925
  return gr.Slider.update()
926
 
927
+ max_keyframe = min((video_frame_count - 2) // interval, MAX_KEYFRAME)
928
 
929
  return gr.Slider.update(value=max_keyframe, maximum=max_keyframe)
930