diff --git a/Dockerfile b/Dockerfile index 3d81f3b3..86e12527 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,18 @@ -FROM nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04 +FROM nvidia/cuda:11.6.0-runtime-ubuntu18.04 ENV DEBIAN_FRONTEND noninteractive +RUN rm /etc/apt/sources.list.d/cuda.list || true +RUN rm /etc/apt/sources.list.d/nvidia-ml.list || true +RUN apt-key del 7fa2af80 +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub + RUN apt update -y RUN apt upgrade -y -RUN apt install -y software-properties-common +RUN apt install -y curl software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa -RUN apt install -y curl python3.9 python3.9-distutils +RUN apt install -y python3.9 python3.9-distutils RUN curl https://bootstrap.pypa.io/get-pip.py | python3.9 WORKDIR /rembg @@ -20,5 +26,6 @@ RUN gdown https://drive.google.com/uc?id=1tCU5MM1LhRgGou5OpmpjBQbSrYIUoYab -O ~/ RUN gdown https://drive.google.com/uc?id=1ZfqwVxu-1XWC1xU1GHIP-FM_Knd_AX5j -O ~/.u2net/u2net_human_seg.onnx RUN gdown https://drive.google.com/uc?id=15rKbQSXQzrKCQurUjZFg8HqzZad8bcyz -O ~/.u2net/u2net_cloth_seg.onnx +EXPOSE 5000 ENTRYPOINT ["rembg"] CMD ["--help"] diff --git a/README.md b/README.md index fb0806b6..6372826e 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,14 @@ Start the server rembg s ``` -Open your browser to +Image with background: ``` -http://localhost:5000?url=http://image.png +https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gull_portrait_ca_usa.jpg/1280px-Gull_portrait_ca_usa.jpg +``` + +Image without background: +``` +http://localhost:5000/?url=https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gull_portrait_ca_usa.jpg/1280px-Gull_portrait_ca_usa.jpg ``` Also you can send the file as a FormData (multipart/form-data): @@ -135,7 +140,17 @@ cv2.imwrite(output_path, output) Try this: ``` -cat in.png | docker run -i --rm danielgatis/rembg i > out.png +docker run -p 5000:5000 rembg s +``` + +Image with background: +``` +https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gull_portrait_ca_usa.jpg/1280px-Gull_portrait_ca_usa.jpg +``` + +Image without background: +``` +http://localhost:5000/?url=https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gull_portrait_ca_usa.jpg/1280px-Gull_portrait_ca_usa.jpg ``` ### Models