abreza commited on
Commit
a944b1e
1 Parent(s): 05dcec5

dont use gfpgan

Browse files
src/facerender/animate.py CHANGED
@@ -20,7 +20,6 @@ from src.facerender.modules.generator import OcclusionAwareGenerator, OcclusionA
20
  from src.facerender.modules.make_animation import make_animation
21
 
22
  from pydub import AudioSegment
23
- from src.utils.face_enhancer import enhancer_generator_with_len, enhancer_list
24
  from src.utils.paste_pic import paste_pic
25
  from src.utils.videoio import save_video_with_watermark
26
 
@@ -233,22 +232,22 @@ class AnimateFromCoeff():
233
  full_video_path = av_path
234
 
235
  #### paste back then enhancers
236
- if enhancer:
237
- video_name_enhancer = x['video_name'] + '_enhanced.mp4'
238
- enhanced_path = os.path.join(video_save_dir, 'temp_'+video_name_enhancer)
239
- av_path_enhancer = os.path.join(video_save_dir, video_name_enhancer)
240
- return_path = av_path_enhancer
241
-
242
- try:
243
- enhanced_images_gen_with_len = enhancer_generator_with_len(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
244
- imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
245
- except:
246
- enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
247
- imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
248
 
249
- save_video_with_watermark(enhanced_path, new_audio_path, av_path_enhancer, watermark= False)
250
- print(f'The generated video is named {video_save_dir}/{video_name_enhancer}')
251
- os.remove(enhanced_path)
252
 
253
  os.remove(path)
254
  os.remove(new_audio_path)
 
20
  from src.facerender.modules.make_animation import make_animation
21
 
22
  from pydub import AudioSegment
 
23
  from src.utils.paste_pic import paste_pic
24
  from src.utils.videoio import save_video_with_watermark
25
 
 
232
  full_video_path = av_path
233
 
234
  #### paste back then enhancers
235
+ # if enhancer:
236
+ # video_name_enhancer = x['video_name'] + '_enhanced.mp4'
237
+ # enhanced_path = os.path.join(video_save_dir, 'temp_'+video_name_enhancer)
238
+ # av_path_enhancer = os.path.join(video_save_dir, video_name_enhancer)
239
+ # return_path = av_path_enhancer
240
+
241
+ # try:
242
+ # enhanced_images_gen_with_len = enhancer_generator_with_len(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
243
+ # imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
244
+ # except:
245
+ # enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
246
+ # imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
247
 
248
+ # save_video_with_watermark(enhanced_path, new_audio_path, av_path_enhancer, watermark= False)
249
+ # print(f'The generated video is named {video_save_dir}/{video_name_enhancer}')
250
+ # os.remove(enhanced_path)
251
 
252
  os.remove(path)
253
  os.remove(new_audio_path)
src/facerender/pirender_animate.py CHANGED
@@ -17,7 +17,6 @@ from src.facerender.pirender.config import Config
17
  from src.facerender.pirender.face_model import FaceGenerator
18
 
19
  from pydub import AudioSegment
20
- from src.utils.face_enhancer import enhancer_generator_with_len, enhancer_list
21
  from src.utils.paste_pic import paste_pic
22
  from src.utils.videoio import save_video_with_watermark
23
 
@@ -106,22 +105,22 @@ class AnimateFromCoeff_PIRender():
106
  full_video_path = av_path
107
 
108
  #### paste back then enhancers
109
- if enhancer:
110
- video_name_enhancer = x['video_name'] + '_enhanced.mp4'
111
- enhanced_path = os.path.join(video_save_dir, 'temp_'+video_name_enhancer)
112
- av_path_enhancer = os.path.join(video_save_dir, video_name_enhancer)
113
- return_path = av_path_enhancer
114
-
115
- try:
116
- enhanced_images_gen_with_len = enhancer_generator_with_len(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
117
- imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
118
- except:
119
- enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
120
- imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
121
 
122
- save_video_with_watermark(enhanced_path, new_audio_path, av_path_enhancer, watermark= False)
123
- print(f'The generated video is named {video_save_dir}/{video_name_enhancer}')
124
- os.remove(enhanced_path)
125
 
126
  os.remove(path)
127
  os.remove(new_audio_path)
 
17
  from src.facerender.pirender.face_model import FaceGenerator
18
 
19
  from pydub import AudioSegment
 
20
  from src.utils.paste_pic import paste_pic
21
  from src.utils.videoio import save_video_with_watermark
22
 
 
105
  full_video_path = av_path
106
 
107
  #### paste back then enhancers
108
+ # if enhancer:
109
+ # video_name_enhancer = x['video_name'] + '_enhanced.mp4'
110
+ # enhanced_path = os.path.join(video_save_dir, 'temp_'+video_name_enhancer)
111
+ # av_path_enhancer = os.path.join(video_save_dir, video_name_enhancer)
112
+ # return_path = av_path_enhancer
113
+
114
+ # try:
115
+ # enhanced_images_gen_with_len = enhancer_generator_with_len(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
116
+ # imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
117
+ # except:
118
+ # enhanced_images_gen_with_len = enhancer_list(full_video_path, method=enhancer, bg_upsampler=background_enhancer)
119
+ # imageio.mimsave(enhanced_path, enhanced_images_gen_with_len, fps=float(25))
120
 
121
+ # save_video_with_watermark(enhanced_path, new_audio_path, av_path_enhancer, watermark= False)
122
+ # print(f'The generated video is named {video_save_dir}/{video_name_enhancer}')
123
+ # os.remove(enhanced_path)
124
 
125
  os.remove(path)
126
  os.remove(new_audio_path)