Rembg is a tool to remove images background
fix gitflow
Daniel Gatis972f82ccbb12
diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.ymlindex 8338e95..a4c5ca6 100644--- a/.github/workflows/lint_python.yml+++ b/.github/workflows/lint_python.yml@@ -7,17 +7,9 @@ jobs:- uses: actions/checkout@v2- uses: actions/setup-python@v2- run: pip install --upgrade pip wheel- - run: pip install bandit black codespell flake8 flake8-bugbear- flake8-comprehensions isort mypy pytest pyupgrade safety- - run: bandit --recursive --skip B101,B104,B310,B311 .- - run: black --check --diff .- - run: codespell- - run: flake8 . --count --ignore=E203,E266,E731,F401,F811,F841,W503- --max-complexity=10 --max-line-length=103 --show-source --statistics- - run: isort --check-only --profile black .- - run: pip install -r requirements.txt- - run: mkdir --parents --verbose .mypy_cache- - run: mypy --ignore-missing-imports --install-types --non-interactive . || true- - run: pytest . || pytest --doctest-modules . || true- - run: shopt -s globstar && pyupgrade --py36-plus **/*.py+ - run: pip install bandit black flake8 flake8-bugbear flake8-comprehensions isort safety+ - run: bandit --recursive --skip B101,B104,B310,B311,B303 ./src+ - run: black --check --diff ./src+ - run: flake8 ./src --count --ignore=E203,E266,E731,F401,F811,F841,W503 --max-complexity=15 --max-line-length=120 --show-source --statistics+ - run: isort --check-only --profile black ./src- run: safety checkdiff --git a/.gitignore b/.gitignoreindex e81f084..8f77185 100644--- a/.gitignore+++ b/.gitignore@@ -1,13 +1,18 @@# general things to ignorebuild/dist/+.venv/+.direnv/*.egg-info/*.egg*.py[cod]__pycache__/*.so-*~+*~≈+.envrc+.python-version# due to using tox and pytest.tox.cache+.mypy_cachediff --git a/src/rembg/cmd/server.py b/src/rembg/cmd/server.pyindex b961b41..98cc7cd 100644--- a/src/rembg/cmd/server.py+++ b/src/rembg/cmd/server.py@@ -2,7 +2,7 @@ import argparseimport globimport osfrom io import BytesIO-from urllib.parse import unquote_plus+from urllib.parse import quote, unquote_plusfrom urllib.request import urlopenfrom flask import Flask, request, send_file@@ -27,7 +27,7 @@ def index():url = request.args.get("url", type=str)if url is None:return {"error": "missing query param 'url'"}, 400-+url = unquote_plus(url)if " " in url:url = quote(url, safe="/:")diff --git a/src/rembg/u2net/detect.py b/src/rembg/u2net/detect.pyindex 6618a7b..62c442d 100644--- a/src/rembg/u2net/detect.py+++ b/src/rembg/u2net/detect.py@@ -2,6 +2,7 @@ import errnoimport osimport sysimport urllib.request+from hashlib import md5import numpy as npimport requests@@ -9,7 +10,6 @@ import torchimport torch.nn as nnimport torch.nn.functional as Fimport torchvision-from hashlib import md5from PIL import Imagefrom skimage import transformfrom torchvision import transforms@@ -52,7 +52,7 @@ def download_file_from_google_drive(id, fname, destination):def load_model(model_name: str = "u2net"):- hashfile = lambda f: md5(open(f,"rb").read()).hexdigest()+ hashfile = lambda f: md5(open(f, "rb").read()).hexdigest()if model_name == "u2netp":net = u2net.U2NETP(3, 1)