jhj0517 commited on
Commit
de78657
·
1 Parent(s): dc1090e

Add type hint and remove meaningless params

Browse files
modules/live_portrait/live_portrait_inferencer.py CHANGED
@@ -10,7 +10,7 @@ import gradio as gr
10
  from gradio_i18n import Translate, gettext as _
11
  from ultralytics.utils import LOGGER as ultralytics_logger
12
  from enum import Enum
13
- from typing import Union
14
 
15
  from modules.utils.paths import *
16
  from modules.utils.image_helper import *
@@ -241,19 +241,16 @@ class LivePortraitInferencer:
241
  raise
242
 
243
  def create_video(self,
244
- retargeting_eyes,
245
- retargeting_mouth,
246
- turn_on,
247
- tracking_src_vid,
248
- animate_without_vid,
249
- command,
250
- crop_factor,
251
- src_images=None,
252
- driving_images=None,
253
- motion_link=None,
254
- progress=gr.Progress()):
255
- if not turn_on:
256
- return None, None
257
  src_length = 1
258
 
259
  if src_images is None:
@@ -272,11 +269,6 @@ class LivePortraitInferencer:
272
  else:
273
  self.psi_list = [self.prepare_source(src_images, crop_factor)]
274
 
275
- cmd_list, cmd_length = self.parsing_command(command, motion_link)
276
- if cmd_list is None:
277
- return None,None
278
- cmd_idx = 0
279
-
280
  driving_length = 0
281
  if driving_images is not None:
282
  if id(driving_images) != id(self.driving_images):
@@ -287,7 +279,7 @@ class LivePortraitInferencer:
287
  total_length = max(driving_length, src_length)
288
 
289
  if animate_without_vid:
290
- total_length = max(total_length, cmd_length)
291
 
292
  c_i_es = ExpressionSet()
293
  c_o_es = ExpressionSet()
 
10
  from gradio_i18n import Translate, gettext as _
11
  from ultralytics.utils import LOGGER as ultralytics_logger
12
  from enum import Enum
13
+ from typing import Union, List, Dict, Tuple
14
 
15
  from modules.utils.paths import *
16
  from modules.utils.image_helper import *
 
241
  raise
242
 
243
  def create_video(self,
244
+ retargeting_eyes: bool,
245
+ retargeting_mouth: bool,
246
+ tracking_src_vid: bool,
247
+ animate_without_vid: bool,
248
+ crop_factor: float,
249
+ src_images: Optional[List[np.ndarray]] = None,
250
+ driving_images: Optional[List[np.ndarray]] = None,
251
+ motion_link: Optional[List] = None,
252
+ progress: gr.Progress = gr.Progress()
253
+ ):
 
 
 
254
  src_length = 1
255
 
256
  if src_images is None:
 
269
  else:
270
  self.psi_list = [self.prepare_source(src_images, crop_factor)]
271
 
 
 
 
 
 
272
  driving_length = 0
273
  if driving_images is not None:
274
  if id(driving_images) != id(self.driving_images):
 
279
  total_length = max(driving_length, src_length)
280
 
281
  if animate_without_vid:
282
+ total_length = total_length
283
 
284
  c_i_es = ExpressionSet()
285
  c_o_es = ExpressionSet()