alexnasa commited on
Commit
1d2b450
·
verified ·
1 Parent(s): 58f3778

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -437,9 +437,9 @@ def get_sam_mask(prompt_state, frames, frame_idx, input_points, input_labels):
437
  :return: (H, W) boolean mask, (H, W) float32 logits (or None), prompt_state
438
  """
439
 
440
- model_cfg = "sam2_hiera_s.yaml"
441
  ckpt_path = "./Wan2.2-Animate-14B/process_checkpoint"
442
- sam2_checkpoint_path = os.path.join(ckpt_path, 'sam2/sam2_hiera_small.pt')
443
 
444
  video_predictor_local = build_sam2_video_predictor(model_cfg, sam2_checkpoint_path, device="cpu")
445
  inference_state = video_predictor_local.init_state(images=np.array(frames), device="cpu")
@@ -526,6 +526,9 @@ def animate_scene(input_video, max_duration_s, edited_frame, rc_str,
526
  if "zerogpu quotas" not in err and "pro gpu quota" not in err:
527
  raise
528
 
 
 
 
529
  max_duration_s = -1
530
 
531
  try:
@@ -797,7 +800,7 @@ with gr.Blocks(css=css, title="Wan 2.2 Animate --replace", theme=gr.themes.Ocean
797
  """)
798
  input_video = gr.Video(label="Input Video", height=512)
799
 
800
- max_duration_slider = gr.Slider(2, 4, 2, step=2, label="Max Duration", visible=False)
801
 
802
  gr.Examples(
803
  examples=[
 
437
  :return: (H, W) boolean mask, (H, W) float32 logits (or None), prompt_state
438
  """
439
 
440
+ model_cfg = "sam2_hiera_l.yaml"
441
  ckpt_path = "./Wan2.2-Animate-14B/process_checkpoint"
442
+ sam2_checkpoint_path = os.path.join(ckpt_path, 'sam2/sam2_hiera_large.pt')
443
 
444
  video_predictor_local = build_sam2_video_predictor(model_cfg, sam2_checkpoint_path, device="cpu")
445
  inference_state = video_predictor_local.init_state(images=np.array(frames), device="cpu")
 
526
  if "zerogpu quotas" not in err and "pro gpu quota" not in err:
527
  raise
528
 
529
+ if max_duration_s > 2:
530
+ raise
531
+
532
  max_duration_s = -1
533
 
534
  try:
 
800
  """)
801
  input_video = gr.Video(label="Input Video", height=512)
802
 
803
+ max_duration_slider = gr.Slider(2, 6, 2, step=2, label="Max Duration", visible=True)
804
 
805
  gr.Examples(
806
  examples=[