Spanicin commited on
Commit
2c89aa0
·
verified ·
1 Parent(s): bd54ea4

Update app_parallel.py

Browse files
Files changed (1) hide show
  1. app_parallel.py +10 -5
app_parallel.py CHANGED
@@ -83,6 +83,7 @@ args = None
83
  unique_id = None
84
  m3u8_path = None
85
  audio_duration = None
 
86
 
87
  app.config['temp_response'] = None
88
  app.config['generation_thread'] = None
@@ -338,7 +339,7 @@ def close_m3u8(m3u8_path: str):
338
 
339
  @app.route("/run", methods=['POST'])
340
  def parallel_processing():
341
- global start_time
342
  global audio_chunks, preprocessed_data, args, m3u8_path, audio_duration
343
  start_time = time.time()
344
  global TEMP_DIR
@@ -391,10 +392,14 @@ def parallel_processing():
391
  ref_pose_video_path = None
392
  args = AnimationConfig(driven_audio_path=driven_audio_path, source_image_path=source_image_path, result_folder=result_folder, pose_style=pose_style, expression_scale=expression_scale,enhancer=enhancer,still=still,preprocess=preprocess,ref_pose_video_path=ref_pose_video_path, image_hardcoded=image_hardcoded)
393
  preprocessed_data = run_preprocessing(args)
394
- chunk_duration = 3
395
- print(f"Splitting the audio into {chunk_duration}-second chunks...")
396
- audio_chunks, audio_duration = split_audio(driven_audio_path, TEMP_DIR, chunk_duration=chunk_duration)
397
- print(f"Audio has been split into {len(audio_chunks)} chunks: {audio_chunks}")
 
 
 
 
398
 
399
  os.makedirs('lives', exist_ok=True)
400
  print("Entering generate m3u8")
 
83
  unique_id = None
84
  m3u8_path = None
85
  audio_duration = None
86
+ driven_audio_path = None
87
 
88
  app.config['temp_response'] = None
89
  app.config['generation_thread'] = None
 
339
 
340
  @app.route("/run", methods=['POST'])
341
  def parallel_processing():
342
+ global start_time, driven_audio_path
343
  global audio_chunks, preprocessed_data, args, m3u8_path, audio_duration
344
  start_time = time.time()
345
  global TEMP_DIR
 
392
  ref_pose_video_path = None
393
  args = AnimationConfig(driven_audio_path=driven_audio_path, source_image_path=source_image_path, result_folder=result_folder, pose_style=pose_style, expression_scale=expression_scale,enhancer=enhancer,still=still,preprocess=preprocess,ref_pose_video_path=ref_pose_video_path, image_hardcoded=image_hardcoded)
394
  preprocessed_data = run_preprocessing(args)
395
+ # chunk_duration = 3
396
+ # print(f"Splitting the audio into {chunk_duration}-second chunks...")
397
+ # audio_chunks, audio_duration = split_audio(driven_audio_path, TEMP_DIR, chunk_duration=chunk_duration)
398
+ # print(f"Audio has been split into {len(audio_chunks)} chunks: {audio_chunks}")
399
+ start_time = 0
400
+ audio_clip = mp.AudioFileClip(driven_audio_path)
401
+ audio_duration = audio_clip.duration
402
+ audio_chunks.append((start_time, driven_audio_path))
403
 
404
  os.makedirs('lives', exist_ok=True)
405
  print("Entering generate m3u8")