chinese-support

#38
Files changed (3) hide show
  1. MyPipe.py +2 -2
  2. README.md +4 -16
  3. 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 = input_image.copy()
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
@@ -11,7 +11,6 @@ tags:
11
  - vision
12
  - legal liability
13
  - transformers
14
- - transformers.js
15
 
16
  extra_gated_description: RMBG v1.4 is available as a source-available model for non-commercial use
17
  extra_gated_heading: "Fill in this form to get instant access"
@@ -35,27 +34,16 @@ It is ideal where content safety, legally licensed datasets, and bias mitigation
35
 
36
  Developed by BRIA AI, RMBG v1.4 is available as a source-available model for non-commercial use.
37
 
38
-
39
- To purchase a commercial license, simply click [Here](https://go.bria.ai/3D5EGp0).
40
-
41
-
42
  [CLICK HERE FOR A DEMO](https://huggingface.co/spaces/briaai/BRIA-RMBG-1.4)
43
-
44
- **NOTE** New RMBG version available! Check out [RMBG-2.0](https://huggingface.co/briaai/RMBG-2.0)
45
-
46
- Join our [Discord community](https://discord.gg/Nxe9YW9zHS) for more information, tutorials, tools, and to connect with other users!
47
-
48
-
49
  ![examples](t4.png)
50
 
51
-
52
  ### Model Description
53
 
54
  - **Developed by:** [BRIA AI](https://bria.ai/)
55
  - **Model type:** Background Removal
56
  - **License:** [bria-rmbg-1.4](https://bria.ai/bria-huggingface-model-license-agreement/)
57
  - The model is released under a Creative Commons license for non-commercial use.
58
- - Commercial use is subject to a commercial agreement with BRIA. To purchase a commercial license simply click [Here](https://go.bria.ai/3B4Asxv).
59
 
60
  - **Model Description:** BRIA RMBG 1.4 is a saliency segmentation model trained exclusively on a professional-grade dataset.
61
  - **BRIA:** Resources for more information: [BRIA AI](https://bria.ai/)
@@ -162,9 +150,9 @@ result=model(image)
162
  result_image = postprocess_image(result[0][0], orig_im_size)
163
 
164
  # save result
165
- pil_mask_im = Image.fromarray(result_image)
 
166
  orig_image = Image.open(image_path)
167
- no_bg_image = orig_image.copy()
168
- no_bg_image.putalpha(pil_mask_im)
169
  ```
170
 
 
11
  - vision
12
  - legal liability
13
  - transformers
 
14
 
15
  extra_gated_description: RMBG v1.4 is available as a source-available model for non-commercial use
16
  extra_gated_heading: "Fill in this form to get instant access"
 
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
  ![examples](t4.png)
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
- pil_mask_im = Image.fromarray(result_image)
 
32
  orig_image = Image.open(im_path)
33
- no_bg_image = orig_image.copy()
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