kiwhansong commited on
Commit
963d046
·
1 Parent(s): 5673a25
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -94,7 +94,7 @@ def video_to_gif_and_images(video, indices):
94
  ]
95
 
96
 
97
- def get_duration_single_image_to_long_video(idx: int, guidance_scale: float, fps: int):
98
  return 30 * fps
99
 
100
 
@@ -121,7 +121,7 @@ def single_image_to_long_video(
121
  return export_to_video(gen_video[0].detach().cpu(), fps=fps)
122
 
123
 
124
- @spaces.GPU(duration=45)
125
  @torch.autocast("cuda")
126
  @torch.no_grad()
127
  def any_images_to_short_video(
@@ -175,6 +175,15 @@ class CustomProgressBar:
175
  def __getattr__(self, attr):
176
  return getattr(self.pbar, attr)
177
 
 
 
 
 
 
 
 
 
 
178
 
179
  @spaces.GPU(duration=45)
180
  @torch.autocast("cuda")
@@ -365,7 +374,7 @@ def _interpolate_between(
365
 
366
 
367
  def get_duration_smooth_navigation(
368
- video: torch.Tensor, poses: torch.Tensor, interpolation_factor: int
369
  ):
370
  length = (len(video) - 1) * interpolation_factor + 1
371
  return 2 * length
 
94
  ]
95
 
96
 
97
+ def get_duration_single_image_to_long_video(idx: int, guidance_scale: float, fps: int, progress:gr.Progress):
98
  return 30 * fps
99
 
100
 
 
121
  return export_to_video(gen_video[0].detach().cpu(), fps=fps)
122
 
123
 
124
+ @spaces.GPU(duration=30)
125
  @torch.autocast("cuda")
126
  @torch.no_grad()
127
  def any_images_to_short_video(
 
175
  def __getattr__(self, attr):
176
  return getattr(self.pbar, attr)
177
 
178
+ def get_duration_navigate_video(video: torch.Tensor,
179
+ poses: torch.Tensor,
180
+ x_angle: float,
181
+ y_angle: float,
182
+ distance: float
183
+ ):
184
+ if abs(x_angle) < 30 and abs(y_angle) < 30 and distance < 150:
185
+ return 45
186
+ return 30
187
 
188
  @spaces.GPU(duration=45)
189
  @torch.autocast("cuda")
 
374
 
375
 
376
  def get_duration_smooth_navigation(
377
+ video: torch.Tensor, poses: torch.Tensor, interpolation_factor: int, progress: gr.Progress
378
  ):
379
  length = (len(video) - 1) * interpolation_factor + 1
380
  return 2 * length