Spaces:
Running
Running
Update predict.py
Browse files- predict.py +2 -2
predict.py
CHANGED
|
@@ -118,7 +118,7 @@ class Predictor:
|
|
| 118 |
logger.error(str(e))
|
| 119 |
raise Exception(str(e))
|
| 120 |
|
| 121 |
-
def enhance_face(self, target_face, target_frame, weight=0.
|
| 122 |
start_x, start_y, end_x, end_y = map(int, target_face['bbox'])
|
| 123 |
padding_x = int((end_x - start_x) * 0.5)
|
| 124 |
padding_y = int((end_y - start_y) * 0.5)
|
|
@@ -176,7 +176,7 @@ class Predictor:
|
|
| 176 |
ext = image_format_by_path(target_image_path)
|
| 177 |
size = os.path.getsize(target_image_path)
|
| 178 |
logger.info(f'origin {size/1024}k')
|
| 179 |
-
result = self.face_swapper.get(frame, target_face, source_face, paste_back=True)
|
| 180 |
if enhance_face:
|
| 181 |
result = self.enhance_face(target_face, result, weight)
|
| 182 |
# _, _, result = self.face_enhancer.enhance(
|
|
|
|
| 118 |
logger.error(str(e))
|
| 119 |
raise Exception(str(e))
|
| 120 |
|
| 121 |
+
def enhance_face(self, target_face, target_frame, weight=0.3):
|
| 122 |
start_x, start_y, end_x, end_y = map(int, target_face['bbox'])
|
| 123 |
padding_x = int((end_x - start_x) * 0.5)
|
| 124 |
padding_y = int((end_y - start_y) * 0.5)
|
|
|
|
| 176 |
ext = image_format_by_path(target_image_path)
|
| 177 |
size = os.path.getsize(target_image_path)
|
| 178 |
logger.info(f'origin {size/1024}k')
|
| 179 |
+
result = self.face_swapper.get(frame, target_face, source_face, paste_back=True, blend_ratio=0.2 )
|
| 180 |
if enhance_face:
|
| 181 |
result = self.enhance_face(target_face, result, weight)
|
| 182 |
# _, _, result = self.face_enhancer.enhance(
|