chinese-support
#38
by
Miykaelxxm
- opened
- MyPipe.py +2 -2
- README.md +4 -15
- example_inference.py +3 -3
MyPipe.py
CHANGED
@@ -50,9 +50,9 @@ class RMBGPipe(Pipeline):
|
|
50 |
pil_im = Image.fromarray(result_image)
|
51 |
if return_mask ==True :
|
52 |
return pil_im
|
|
|
53 |
input_image = load_image(input_image)
|
54 |
-
no_bg_image =
|
55 |
-
no_bg_image.putalpha(pil_im)
|
56 |
return no_bg_image
|
57 |
|
58 |
# utilities functions
|
|
|
50 |
pil_im = Image.fromarray(result_image)
|
51 |
if return_mask ==True :
|
52 |
return pil_im
|
53 |
+
no_bg_image = Image.new("RGBA", pil_im.size, (0,0,0,0))
|
54 |
input_image = load_image(input_image)
|
55 |
+
no_bg_image.paste(input_image, mask=pil_im)
|
|
|
56 |
return no_bg_image
|
57 |
|
58 |
# utilities functions
|
README.md
CHANGED
@@ -34,27 +34,16 @@ It is ideal where content safety, legally licensed datasets, and bias mitigation
|
|
34 |
|
35 |
Developed by BRIA AI, RMBG v1.4 is available as a source-available model for non-commercial use.
|
36 |
|
37 |
-
|
38 |
-
To purchase a commercial license, simply click [Here](https://go.bria.ai/3D5EGp0).
|
39 |
-
|
40 |
-
|
41 |
[CLICK HERE FOR A DEMO](https://huggingface.co/spaces/briaai/BRIA-RMBG-1.4)
|
42 |
-
|
43 |
-
**NOTE** New RMBG version available! Check out [RMBG-2.0](https://huggingface.co/briaai/RMBG-2.0)
|
44 |
-
|
45 |
-
Join our [Discord community](https://discord.gg/Nxe9YW9zHS) for more information, tutorials, tools, and to connect with other users!
|
46 |
-
|
47 |
-
|
48 |

|
49 |
|
50 |
-
|
51 |
### Model Description
|
52 |
|
53 |
- **Developed by:** [BRIA AI](https://bria.ai/)
|
54 |
- **Model type:** Background Removal
|
55 |
- **License:** [bria-rmbg-1.4](https://bria.ai/bria-huggingface-model-license-agreement/)
|
56 |
- The model is released under a Creative Commons license for non-commercial use.
|
57 |
-
- Commercial use is subject to a commercial agreement with BRIA.
|
58 |
|
59 |
- **Model Description:** BRIA RMBG 1.4 is a saliency segmentation model trained exclusively on a professional-grade dataset.
|
60 |
- **BRIA:** Resources for more information: [BRIA AI](https://bria.ai/)
|
@@ -161,9 +150,9 @@ result=model(image)
|
|
161 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
162 |
|
163 |
# save result
|
164 |
-
|
|
|
165 |
orig_image = Image.open(image_path)
|
166 |
-
no_bg_image =
|
167 |
-
no_bg_image.putalpha(pil_mask_im)
|
168 |
```
|
169 |
|
|
|
34 |
|
35 |
Developed by BRIA AI, RMBG v1.4 is available as a source-available model for non-commercial use.
|
36 |
|
|
|
|
|
|
|
|
|
37 |
[CLICK HERE FOR A DEMO](https://huggingface.co/spaces/briaai/BRIA-RMBG-1.4)
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |

|
39 |
|
|
|
40 |
### Model Description
|
41 |
|
42 |
- **Developed by:** [BRIA AI](https://bria.ai/)
|
43 |
- **Model type:** Background Removal
|
44 |
- **License:** [bria-rmbg-1.4](https://bria.ai/bria-huggingface-model-license-agreement/)
|
45 |
- The model is released under a Creative Commons license for non-commercial use.
|
46 |
+
- Commercial use is subject to a commercial agreement with BRIA. [Contact Us](https://bria.ai/contact-us) for more information.
|
47 |
|
48 |
- **Model Description:** BRIA RMBG 1.4 is a saliency segmentation model trained exclusively on a professional-grade dataset.
|
49 |
- **BRIA:** Resources for more information: [BRIA AI](https://bria.ai/)
|
|
|
150 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
151 |
|
152 |
# save result
|
153 |
+
pil_im = Image.fromarray(result_image)
|
154 |
+
no_bg_image = Image.new("RGBA", pil_im.size, (0,0,0,0))
|
155 |
orig_image = Image.open(image_path)
|
156 |
+
no_bg_image.paste(orig_image, mask=pil_im)
|
|
|
157 |
```
|
158 |
|
example_inference.py
CHANGED
@@ -28,10 +28,10 @@ def example_inference():
|
|
28 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
29 |
|
30 |
# save result
|
31 |
-
|
|
|
32 |
orig_image = Image.open(im_path)
|
33 |
-
no_bg_image =
|
34 |
-
no_bg_image.putalpha(pil_mask_im)
|
35 |
no_bg_image.save("example_image_no_bg.png")
|
36 |
|
37 |
|
|
|
28 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
29 |
|
30 |
# save result
|
31 |
+
pil_im = Image.fromarray(result_image)
|
32 |
+
no_bg_image = Image.new("RGBA", pil_im.size, (0,0,0,0))
|
33 |
orig_image = Image.open(im_path)
|
34 |
+
no_bg_image.paste(orig_image, mask=pil_im)
|
|
|
35 |
no_bg_image.save("example_image_no_bg.png")
|
36 |
|
37 |
|