Last active
February 25, 2024 19:19
-
-
Save benperiton/2d37ea18377a80f9b9768522d08a4253 to your computer and use it in GitHub Desktop.
backgroundremover test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
backgroundremover: | |
build: | |
context: ./ | |
dockerfile: Dockerfile | |
args: | |
- UID=1000 | |
- GID=1001 | |
container_name: "backgroundremover" | |
user: "1000:1001" | |
restart: "no" | |
volumes: | |
- './images:/app:rw' | |
working_dir: /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6-slim | |
ARG UID | |
ARG GID | |
RUN groupadd -g "${GID}" app \ | |
&& useradd --create-home --no-log-init -u "${UID}" -g "${GID}" app | |
RUN apt-get update && \ | |
apt-get -y install python3-pip && \ | |
apt-get -y install ffmpeg imagemagick | |
USER app | |
RUN pip install --default-timeout=1000 torch torchvision backgroundremover | |
WORKDIR /app | |
ENTRYPOINT ["tail"] | |
CMD ["-f","/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -it backgroundremover /bin/bash | |
/home/app/.local/bin/backgroundremover -i input.jpeg -m u2net_human_seg -o output.jpeg | |
convert output.jpeg -colorspace Gray -trim final.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No reason at all, I was just playing around with it and that happened to be what I typed :)