Spanicin commited on
Commit
af26267
·
verified ·
1 Parent(s): a83c683

Update app_parallel.py

Browse files
Files changed (1) hide show
  1. app_parallel.py +8 -8
app_parallel.py CHANGED
@@ -36,7 +36,7 @@ class AnimationConfig:
36
  self.driven_audio = driven_audio_path
37
  self.source_image = source_image_path
38
  self.ref_eyeblink = None
39
- self.ref_pose = ref_pose_video_path
40
  self.checkpoint_dir = './checkpoints'
41
  self.result_dir = result_folder
42
  self.pose_style = pose_style
@@ -310,7 +310,7 @@ def parallel_processing():
310
  print('still', still)
311
  preprocess = request.form.get('preprocess', 'crop')
312
  print('preprocess selected: ',preprocess)
313
- ref_pose_video = request.files.get('ref_pose', None)
314
 
315
  app.config['text_prompt'] = text_prompt
316
  print('Final output text prompt using openai: ',text_prompt)
@@ -325,15 +325,15 @@ def parallel_processing():
325
  os.makedirs(result_folder, exist_ok=True)
326
 
327
  ref_pose_video_path = None
328
- if ref_pose_video:
329
- with tempfile.NamedTemporaryFile(suffix=".mp4", prefix="ref_pose_",dir=TEMP_DIR.name, delete=False) as temp_file:
330
- ref_pose_video_path = temp_file.name
331
- ref_pose_video.save(ref_pose_video_path)
332
- print('ref_pose_video_path',ref_pose_video_path)
333
 
334
  except Exception as e:
335
  app.logger.error(f"An error occurred: {e}")
336
- return "An error occurred", 500
337
 
338
  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)
339
 
 
36
  self.driven_audio = driven_audio_path
37
  self.source_image = source_image_path
38
  self.ref_eyeblink = None
39
+ self.ref_pose = None
40
  self.checkpoint_dir = './checkpoints'
41
  self.result_dir = result_folder
42
  self.pose_style = pose_style
 
310
  print('still', still)
311
  preprocess = request.form.get('preprocess', 'crop')
312
  print('preprocess selected: ',preprocess)
313
+ # ref_pose_video = request.files.get('ref_pose', None)
314
 
315
  app.config['text_prompt'] = text_prompt
316
  print('Final output text prompt using openai: ',text_prompt)
 
325
  os.makedirs(result_folder, exist_ok=True)
326
 
327
  ref_pose_video_path = None
328
+ # if ref_pose_video:
329
+ # with tempfile.NamedTemporaryFile(suffix=".mp4", prefix="ref_pose_",dir=TEMP_DIR.name, delete=False) as temp_file:
330
+ # ref_pose_video_path = temp_file.name
331
+ # ref_pose_video.save(ref_pose_video_path)
332
+ # print('ref_pose_video_path',ref_pose_video_path)
333
 
334
  except Exception as e:
335
  app.logger.error(f"An error occurred: {e}")
336
+ return jsonify({'status': 'error', 'message': str(e)}), 500
337
 
338
  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)
339