jhj0517
commited on
Commit
·
2d217e7
1
Parent(s):
922c507
Use util function
Browse files
modules/live_portrait/live_portrait_inferencer.py
CHANGED
|
@@ -205,11 +205,10 @@ class LivePortraitInferencer:
|
|
| 205 |
crop_with_fullsize = cv2.warpAffine(crop_out, psi.crop_trans_m, get_rgb_size(psi.src_rgb), cv2.INTER_LINEAR)
|
| 206 |
out = np.clip(psi.mask_ori * crop_with_fullsize + (1 - psi.mask_ori) * psi.src_rgb, 0, 255).astype(np.uint8)
|
| 207 |
|
| 208 |
-
cropped_img, out_img = Image.fromarray(crop_out), Image.fromarray(out)
|
| 209 |
temp_out_img_path, out_img_path = get_auto_incremental_file_path(TEMP_DIR, "png"), get_auto_incremental_file_path(OUTPUTS_DIR, "png")
|
|
|
|
|
|
|
| 210 |
|
| 211 |
-
cropped_img.save(temp_out_img_path, compress_level=1, format="png")
|
| 212 |
-
out_img.save(out_img_path, compress_level=1, format="png")
|
| 213 |
new_editor_link.append(es)
|
| 214 |
|
| 215 |
return out
|
|
|
|
| 205 |
crop_with_fullsize = cv2.warpAffine(crop_out, psi.crop_trans_m, get_rgb_size(psi.src_rgb), cv2.INTER_LINEAR)
|
| 206 |
out = np.clip(psi.mask_ori * crop_with_fullsize + (1 - psi.mask_ori) * psi.src_rgb, 0, 255).astype(np.uint8)
|
| 207 |
|
|
|
|
| 208 |
temp_out_img_path, out_img_path = get_auto_incremental_file_path(TEMP_DIR, "png"), get_auto_incremental_file_path(OUTPUTS_DIR, "png")
|
| 209 |
+
save_image(numpy_array=crop_out, output_path=temp_out_img_path)
|
| 210 |
+
save_image(numpy_array=out, output_path=out_img_path)
|
| 211 |
|
|
|
|
|
|
|
| 212 |
new_editor_link.append(es)
|
| 213 |
|
| 214 |
return out
|