Spaces:
Running
on
Zero
Running
on
Zero
Update src/gradio_pipeline.py
Browse files- src/gradio_pipeline.py +3 -1
src/gradio_pipeline.py
CHANGED
@@ -10,6 +10,7 @@ from .utils.io import load_img_online
|
|
10 |
from .utils.rprint import rlog as log
|
11 |
from .utils.crop import prepare_paste_back, paste_back
|
12 |
# from .utils.camera import get_rotation_matrix
|
|
|
13 |
|
14 |
def update_args(args, user_args):
|
15 |
"""update the args according to user inputs
|
@@ -122,7 +123,8 @@ class GradioPipeline(LivePortraitPipeline):
|
|
122 |
######## process source portrait ########
|
123 |
img_rgb = load_img_online(input_image, mode='rgb', max_dim=1280, n=16)
|
124 |
log(f"Load source image from {input_image}.")
|
125 |
-
crop_info = self.cropper.crop_source_image(img_rgb, self.cropper.crop_cfg)
|
|
|
126 |
if crop_info is None:
|
127 |
raise gr.Error("Source portrait NO face detected", duration=2)
|
128 |
source_eye_ratio = calc_eye_close_ratio(crop_info['lmk_crop'][None])
|
|
|
10 |
from .utils.rprint import rlog as log
|
11 |
from .utils.crop import prepare_paste_back, paste_back
|
12 |
# from .utils.camera import get_rotation_matrix
|
13 |
+
from .utils.retargeting_utils import calc_eye_close_ratio, calc_lip_close_ratio
|
14 |
|
15 |
def update_args(args, user_args):
|
16 |
"""update the args according to user inputs
|
|
|
123 |
######## process source portrait ########
|
124 |
img_rgb = load_img_online(input_image, mode='rgb', max_dim=1280, n=16)
|
125 |
log(f"Load source image from {input_image}.")
|
126 |
+
#crop_info = self.cropper.crop_source_image(img_rgb, self.cropper.crop_cfg)
|
127 |
+
crop_info = self.cropper.crop_single_image(img_rgb)
|
128 |
if crop_info is None:
|
129 |
raise gr.Error("Source portrait NO face detected", duration=2)
|
130 |
source_eye_ratio = calc_eye_close_ratio(crop_info['lmk_crop'][None])
|