Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgatis committed Jan 9, 2022
1 parent 0fd9774 commit fe0823e
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
src/_version.py export-subst
src/rembg/_version.py export-subst
rembg/_version.py export-subst
8 changes: 4 additions & 4 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
- uses: actions/setup-python@v2
- run: pip install --upgrade pip wheel
- run: pip install bandit black flake8 flake8-bugbear flake8-comprehensions isort safety
- run: bandit --recursive --skip B101,B104,B310,B311,B303 --exclude ./src/_version.py ./src
- run: black --force-exclude src/_version.py --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 --exclude ./src/_version.py
- run: isort --check-only --profile black ./src
- run: bandit --recursive --skip B101,B104,B310,B311,B303 --exclude ./rembg/_version.py ./rembg
- run: black --force-exclude src/_version.py --check --diff ./rembg
- run: flake8 ./rembg --count --ignore=E203,E266,E731,F401,F811,F841,W503 --max-complexity=15 --max-line-length=120 --show-source --statistics --exclude ./rembg/_version.py
- run: isort --check-only --profile black ./rembg
- run: safety check
17 changes: 5 additions & 12 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
include pyproject.toml

# Include the README
include *.md

# Include the license file
include MANIFEST.in
include LICENSE.txt
include README.md
include setup.py
include pyproject.toml

# Include the data files
recursive-include data *

include requirements.txt
include versioneer.py
include src/_version.py
include src/rembg/_version.py
include rembg/_version.py
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ build-backend = "setuptools.build_meta"

[versioneer]
VCS = "git"
style = "default"
versionfile_source = "src/rembg/_version.py"
versionfile_build = "_version.py"
tag_prefix = ""
style = "pep440"
versionfile_source = "rembg/_version.py"
versionfile_build = "rembg/_version.py"
tag_prefix = "v"
parentdir_prefix = "rembg-"
File renamed without changes.
8 changes: 4 additions & 4 deletions src/rembg/_version.py → rembg/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def get_config():
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "default"
cfg.tag_prefix = ""
cfg.parentdir_prefix = "None"
cfg.versionfile_source = "src/rembg/_version.py"
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "rembg-"
cfg.versionfile_source = "rembg/_version.py"
cfg.verbose = False
return cfg

Expand Down
7 changes: 4 additions & 3 deletions src/rembg/bg.py → rembg/bg.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,20 @@ def resize_image(img, width, height):

def remove(
data,
width,
height,
model_name="u2net",
alpha_matting=False,
alpha_matting_foreground_threshold=240,
alpha_matting_background_threshold=10,
alpha_matting_erode_structure_size=10,
alpha_matting_base_size=1000,
width=None,
height=None,
):
model = get_model(model_name)
img = Image.open(io.BytesIO(data)).convert("RGB")
if width is not None or height is not None:
img = resize_image(img, width, height)

model = get_model(model_name)
mask = detect.predict(model, np.array(img)).convert("L")

if alpha_matting:
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/rembg/cmd/server.py → rembg/cmd/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def index():
BytesIO(
remove(
file_content,
width,
height,
width=width,
height=height,
model_name=model,
alpha_matting=alpha_matting,
alpha_matting_foreground_threshold=af,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
flask==1.1.2
numpy==1.19.5
pillow==8.0.1
scikit-image==0.17.2
numpy==1.22.0
pillow==8.1.2
scikit-image==0.19.1
torch==1.9.1
torchvision==0.10.1
waitress==1.4.4
Expand Down
9 changes: 5 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ license_files = LICENSE.txt

[versioneer]
VCS = git
style = default
versionfile_source = src/rembg/_version.py
versionfile_build = _version.py
tag_prefix =
style = pep440
versionfile_source = rembg/_version.py
versionfile_build = rembg/_version.py
tag_prefix = v
parentdir_prefix = rembg-
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import pathlib
import sys
import os

sys.path.append(os.path.dirname(__file__))
import versioneer

from setuptools import find_packages, setup
Expand All @@ -23,8 +27,7 @@
"Programming Language :: Python :: 3 :: Only",
],
keywords="remove, background, u2net",
package_dir={"": "src"},
packages=find_packages(where="src"),
packages=find_packages(include=["rembg"]),
python_requires=">=3.8, <4",
install_requires=requireds,
entry_points={
Expand Down

0 comments on commit fe0823e

Please sign in to comment.