Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

fix python version

Daniel Gatisf19ec10e4b44
diff --git a/Dockerfile b/Dockerfile
index dfd8596..680e180 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,17 +1,23 @@
FROM nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04
-RUN apt-get update &&\
- apt-get install -y --no-install-recommends \
- python3 \
- python3-pip \
- python3-dev \
- build-essential
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt update -y
+RUN apt upgrade -y
+RUN apt install -y software-properties-common
+RUN add-apt-repository ppa:deadsnakes/ppa
+RUN apt install -y curl python3.9 python3.9-distutils
+RUN curl https://bootstrap.pypa.io/get-pip.py | python3.9
WORKDIR /rembg
COPY . .
+RUN python3.9 -m pip install .[gpu]
-RUN ["pip3", "install", ".[gpu]"]
+RUN mkdir -p ~/.u2net
+RUN gdown https://drive.google.com/uc?id=1tNuFmLv0TSNDjYIkjEdeH1IWKQdUA4HR -O ~/.u2net/u2netp.onnx
+RUN gdown https://drive.google.com/uc?id=1tCU5MM1LhRgGou5OpmpjBQbSrYIUoYab -O ~/.u2net/u2net.onnx
+RUN gdown https://drive.google.com/uc?id=1ZfqwVxu-1XWC1xU1GHIP-FM_Knd_AX5j -O ~/.u2net/u2net_human_seg.onnx
ENTRYPOINT ["rembg"]
-CMD []
+CMD ["--help"]
diff --git a/README.md b/README.md
index c4e3bd5..7374e57 100644
--- a/README.md
+++ b/README.md
@@ -36,8 +36,11 @@ Rembg is a tool to remove images background. That is it.
**If this project has helped you in any way, please consider making a [donation](https://www.buymeacoffee.com/danielgatis).**
+
### Installation
+**!! This library is for Python 3.9 only !!**.
+
CPU support:
```bash
pip install rembg
@@ -129,16 +132,10 @@ cv2.imwrite(output_path, output)
### Usage as a docker
-First compile with:
-
-```
-docker build . -t rembg
-```
-
-Then run with:
+Try this:
```
-docker run --rm -i rembg i in.png out.png
+cat in.png | docker run -i --rm danielgatis/rembg i > out.png
```
### Advance usage