Spanicin commited on
Commit
aa16990
·
verified ·
1 Parent(s): 1f94d2d

Updated app.py with reference pose path

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -25,11 +25,11 @@ import time
25
  start_time = time.time()
26
 
27
  class AnimationConfig:
28
- def __init__(self, driven_audio_path, source_image_path, result_folder,pose_style,expression_scale,enhancer,still,preprocess):
29
  self.driven_audio = driven_audio_path
30
  self.source_image = source_image_path
31
  self.ref_eyeblink = None
32
- self.ref_pose = None
33
  self.checkpoint_dir = './checkpoints'
34
  self.result_dir = result_folder
35
  self.pose_style = pose_style
@@ -213,6 +213,7 @@ def generate_video():
213
  print('still', still)
214
  preprocess = request.form.get('preprocess', 'crop')
215
  print('preprocess selected: ',preprocess)
 
216
 
217
  if target_language != 'original_text':
218
  response = translate_text(text_prompt, target_language)
@@ -264,8 +265,13 @@ def generate_video():
264
  result_folder = os.path.join(save_dir, "results")
265
  os.makedirs(result_folder, exist_ok=True)
266
 
 
 
 
 
 
267
  # Example of using the class with some hypothetical paths
268
- 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)
269
 
270
  if torch.cuda.is_available() and not args.cpu:
271
  args.device = "cuda"
 
25
  start_time = time.time()
26
 
27
  class AnimationConfig:
28
+ def __init__(self, driven_audio_path, source_image_path, result_folder,pose_style,expression_scale,enhancer,still,preprocess,ref_pose_video_path):
29
  self.driven_audio = driven_audio_path
30
  self.source_image = source_image_path
31
  self.ref_eyeblink = None
32
+ self.ref_pose = ref_pose_video_path
33
  self.checkpoint_dir = './checkpoints'
34
  self.result_dir = result_folder
35
  self.pose_style = pose_style
 
213
  print('still', still)
214
  preprocess = request.form.get('preprocess', 'crop')
215
  print('preprocess selected: ',preprocess)
216
+ ref_pose_video = request.files['ref_pose']
217
 
218
  if target_language != 'original_text':
219
  response = translate_text(text_prompt, target_language)
 
265
  result_folder = os.path.join(save_dir, "results")
266
  os.makedirs(result_folder, exist_ok=True)
267
 
268
+ with tempfile.NamedTemporaryFile(suffix=".mp4", prefix="ref_pose_",dir=TEMP_DIR.name, delete=False) as temp_file:
269
+ ref_pose_video_path = temp_file.name
270
+ ref_pose_video.save(ref_pose_video_path)
271
+ print('ref_pose_video_path',ref_pose_video_path)
272
+
273
  # Example of using the class with some hypothetical paths
274
+ 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)
275
 
276
  if torch.cuda.is_available() and not args.cpu:
277
  args.device = "cuda"