dagloop5 commited on
Commit
eb2140a
·
verified ·
1 Parent(s): be70ca1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -938,7 +938,14 @@ def generate(
938
  chunk_duration = float(chunk_stop) - float(chunk_start)
939
  if chunk_duration <= 0:
940
  raise gr.Error("Chunk stop must be after chunk start.")
941
- num_frames = snap_frames(chunk_duration)
 
 
 
 
 
 
 
942
 
943
  skip_recondition = advance and stage_state is not None and not recondition
944
  if skip_recondition:
@@ -1082,7 +1089,7 @@ def generate(
1082
  # The momentum-imposed opening is a *regeneration* of the previous chunk's own tail, not new content —
1083
  # trimmed here so concatenation doesn't duplicate it. Only continuation chunks that actually had momentum
1084
  # applied carry anything to trim; chunk one, and any chunk that fell back to a plain keyframe carry, don't.
1085
- chunk_output = _trim_head(path, float(momentum)) if (chunk_advance and given_video is not None) else path
1086
  chunk_paths = prior_paths + [chunk_output]
1087
  path = _concat_chunks(chunk_paths) if len(chunk_paths) > 1 else chunk_output
1088
  new_chunk_state = {"paths": chunk_paths}
 
938
  chunk_duration = float(chunk_stop) - float(chunk_start)
939
  if chunk_duration <= 0:
940
  raise gr.Error("Chunk stop must be after chunk start.")
941
+ # A momentum-carrying chunk regenerates its own opening `momentum_seconds` from the previous chunk's
942
+ # tail, which `_trim_head` removes again before appending — so the chunk's own generation has to run
943
+ # `momentum_seconds` longer than requested, or trimming that regenerated span back off leaves less new
944
+ # content than the chunk stop/start actually asked for. `snap_frames(momentum)/FPS`, not the raw slider
945
+ # value, since that's the real, frame-aligned duration `_trailing_frames` actually extracted and
946
+ # `MiniMaxH3MomentumConditionStep` actually imposed.
947
+ momentum_seconds = snap_frames(float(momentum)) / FPS if given_video is not None else 0.0
948
+ num_frames = snap_frames(chunk_duration + momentum_seconds)
949
 
950
  skip_recondition = advance and stage_state is not None and not recondition
951
  if skip_recondition:
 
1089
  # The momentum-imposed opening is a *regeneration* of the previous chunk's own tail, not new content —
1090
  # trimmed here so concatenation doesn't duplicate it. Only continuation chunks that actually had momentum
1091
  # applied carry anything to trim; chunk one, and any chunk that fell back to a plain keyframe carry, don't.
1092
+ chunk_output = _trim_head(path, momentum_seconds) if (chunk_advance and given_video is not None) else path
1093
  chunk_paths = prior_paths + [chunk_output]
1094
  path = _concat_chunks(chunk_paths) if len(chunk_paths) > 1 else chunk_output
1095
  new_chunk_state = {"paths": chunk_paths}