openfree commited on
Commit
3a4d626
ยท
verified ยท
1 Parent(s): 2902887

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -205,7 +205,7 @@ 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
- # ๋น„๋””์˜ค ๋กœ๋“œ - 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)
@@ -225,17 +225,18 @@ def video_to_audio(video_path, prompt, negative_prompt="music", seed=0, num_step
225
  cfg_strength=cfg_strength)
226
  audio = audios.float().cpu()[0]
227
 
228
- # ๋น„๋””์˜ค์™€ ์˜ค๋””์˜ค ๊ฒฐํ•ฉ
229
  video_save_path = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name
230
  make_video(video_path,
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:
238
  logging.error(f"Video to audio error: {str(e)}")
 
 
239
  return video_path
240
 
241
  def generate_video_from_image(image, prompt="", length=4.0, sound_generation="์‚ฌ์šด๋“œ ์—†์Œ", sound_prompt="", sound_negative_prompt="music"):
 
205
  rng.manual_seed(seed)
206
  fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
207
 
208
+ # ๋น„๋””์˜ค ๋กœ๋“œ - ๋ฐ˜ํ™˜๋˜๋Š” 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)
 
225
  cfg_strength=cfg_strength)
226
  audio = audios.float().cpu()[0]
227
 
228
+ # ๋น„๋””์˜ค์™€ ์˜ค๋””์˜ค ๊ฒฐํ•ฉ - duration_sec ๋งค๊ฐœ๋ณ€์ˆ˜ ์ œ๊ฑฐ
229
  video_save_path = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name
230
  make_video(video_path,
231
  video_save_path,
232
  audio,
233
+ sampling_rate=mmaudio_seq_cfg.sampling_rate)
 
234
 
235
  return video_save_path
236
  except Exception as e:
237
  logging.error(f"Video to audio error: {str(e)}")
238
+ import traceback
239
+ traceback.print_exc()
240
  return video_path
241
 
242
  def generate_video_from_image(image, prompt="", length=4.0, sound_generation="์‚ฌ์šด๋“œ ์—†์Œ", sound_prompt="", sound_negative_prompt="music"):