Merge pull request #65 from bendangnuksung/master

Update README.md
This commit is contained in:
Daniel Gatis 2021-01-22 12:35:59 -03:00 committed by GitHub
commit b8e0812497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,8 +84,8 @@ Also you can send the file as a FormData (multipart/form-data):
```
### Usage as a library
In `app.py`
Examples:
1. In `app.py`
```python
import sys
@ -99,6 +99,21 @@ Then run
cat input.png | python app.py > out.png
```
2. ```python
from rembg.bg import remove
import numpy as np
import io
from PIL import Image
input_path = 'input.png'
output_path = 'out.png'
f = np.fromfile(input_path)
result = remove(f)
img = Image.open(io.BytesIO(result)).convert("RGBA")
img.save(output_path)
```
### Usage as a docker
Just run