Spaces:
Running
on
Zero
Running
on
Zero
manual mask
Browse files- app.py +4 -1
- demo/rm_bg.py +1 -0
app.py
CHANGED
@@ -117,7 +117,10 @@ with gr.Blocks(title="DiLightNet Demo") as demo:
|
|
117 |
seed=int(relighting_seed),
|
118 |
cfg=relighting_cfg
|
119 |
)
|
120 |
-
|
|
|
|
|
|
|
121 |
return res
|
122 |
|
123 |
|
|
|
117 |
seed=int(relighting_seed),
|
118 |
cfg=relighting_cfg
|
119 |
)
|
120 |
+
mask_for_bg = imageio.v3.imread(res_folder_path + '/hint00_diffuse.png')[..., -1:] / 255.
|
121 |
+
res = imageio.v3.imread(res_folder_path + '/relighting00.png') / 255.
|
122 |
+
res = res * mask_for_bg # + bg * (1. - mask_for_bg)
|
123 |
+
res = (res * 255).clip(0, 255).astype(np.uint8)
|
124 |
return res
|
125 |
|
126 |
|
demo/rm_bg.py
CHANGED
@@ -3,6 +3,7 @@ import rembg
|
|
3 |
|
4 |
|
5 |
def rm_bg(img, use_sam=False):
|
|
|
6 |
output = rembg.remove(img)
|
7 |
mask = np.array(output)[:, :, 3]
|
8 |
|
|
|
3 |
|
4 |
|
5 |
def rm_bg(img, use_sam=False):
|
6 |
+
print(type(img))
|
7 |
output = rembg.remove(img)
|
8 |
mask = np.array(output)[:, :, 3]
|
9 |
|