jhj0517
commited on
Commit
·
e679e08
1
Parent(s):
f3bd536
Save temp & output images
Browse files
modules/live_portrait/live_portrait_inferencer.py
CHANGED
|
@@ -200,13 +200,14 @@ class LivePortraitInferencer:
|
|
| 200 |
crop_with_fullsize = cv2.warpAffine(crop_out, psi.crop_trans_m, get_rgb_size(psi.src_rgb), cv2.INTER_LINEAR)
|
| 201 |
out = np.clip(psi.mask_ori * crop_with_fullsize + (1 - psi.mask_ori) * psi.src_rgb, 0, 255).astype(np.uint8)
|
| 202 |
|
| 203 |
-
|
|
|
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
new_editor_link.append(es)
|
| 208 |
|
| 209 |
-
return out
|
| 210 |
except Exception as e:
|
| 211 |
raise
|
| 212 |
|
|
|
|
| 200 |
crop_with_fullsize = cv2.warpAffine(crop_out, psi.crop_trans_m, get_rgb_size(psi.src_rgb), cv2.INTER_LINEAR)
|
| 201 |
out = np.clip(psi.mask_ori * crop_with_fullsize + (1 - psi.mask_ori) * psi.src_rgb, 0, 255).astype(np.uint8)
|
| 202 |
|
| 203 |
+
cropped_img, out_img = Image.fromarray(crop_out), Image.fromarray(out)
|
| 204 |
+
temp_out_img_path, out_img_path = get_auto_incremental_file_path(TEMP_DIR, "png"), get_auto_incremental_file_path(OUTPUTS_DIR, "png")
|
| 205 |
|
| 206 |
+
cropped_img.save(temp_out_img_path, compress_level=1, format="png")
|
| 207 |
+
out_img.save(out_img_path, compress_level=1, format="png")
|
| 208 |
new_editor_link.append(es)
|
| 209 |
|
| 210 |
+
return out
|
| 211 |
except Exception as e:
|
| 212 |
raise
|
| 213 |
|