Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -205,10 +205,12 @@ def video_to_audio(video_path, prompt, negative_prompt="music", seed=0, num_step
|
|
205 |
rng.manual_seed(seed)
|
206 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
207 |
|
208 |
-
# 비디오 로드
|
209 |
clip_frames, sync_frames, actual_duration = load_video(video_path, duration)
|
210 |
clip_frames = clip_frames.unsqueeze(0)
|
211 |
sync_frames = sync_frames.unsqueeze(0)
|
|
|
|
|
212 |
mmaudio_seq_cfg.duration = actual_duration
|
213 |
mmaudio_net.update_seq_lengths(mmaudio_seq_cfg.latent_seq_len, mmaudio_seq_cfg.clip_seq_len, mmaudio_seq_cfg.sync_seq_len)
|
214 |
|
@@ -229,7 +231,7 @@ def video_to_audio(video_path, prompt, negative_prompt="music", seed=0, num_step
|
|
229 |
video_save_path,
|
230 |
audio,
|
231 |
sampling_rate=mmaudio_seq_cfg.sampling_rate,
|
232 |
-
duration_sec=
|
233 |
|
234 |
return video_save_path
|
235 |
except Exception as e:
|
|
|
205 |
rng.manual_seed(seed)
|
206 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
207 |
|
208 |
+
# 비디오 로드 - load_video가 실제 duration을 반환함
|
209 |
clip_frames, sync_frames, actual_duration = load_video(video_path, duration)
|
210 |
clip_frames = clip_frames.unsqueeze(0)
|
211 |
sync_frames = sync_frames.unsqueeze(0)
|
212 |
+
|
213 |
+
# 실제 비디오 길이로 seq_cfg 업데이트
|
214 |
mmaudio_seq_cfg.duration = actual_duration
|
215 |
mmaudio_net.update_seq_lengths(mmaudio_seq_cfg.latent_seq_len, mmaudio_seq_cfg.clip_seq_len, mmaudio_seq_cfg.sync_seq_len)
|
216 |
|
|
|
231 |
video_save_path,
|
232 |
audio,
|
233 |
sampling_rate=mmaudio_seq_cfg.sampling_rate,
|
234 |
+
duration_sec=actual_duration) # actual_duration 사용
|
235 |
|
236 |
return video_save_path
|
237 |
except Exception as e:
|