Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing-su committed Mar 28, 2024
2 parents 31b8122 + b77dcd7 commit 372e8b7
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 126 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish to PyPI
on:
push:
tags:
- "v*"

jobs:
test:
name: test
runs-on: macos-14
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install .
pip install pytest
- name: Run tests
run: pytest -v

build:
name: build
runs-on: ubuntu-latest
permissions:
id-token: write
needs: [test]

steps:
- uses: actions/checkout@v4

- name: Build wheel
run: pipx run build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Close stale issues and PRs'
name: Close stale issues and PRs
on:
schedule:
- cron: '30 1 * * *'
Expand All @@ -9,5 +9,5 @@ jobs:
steps:
- uses: actions/stale@v9
with:
days-before-stale: 23
days-before-stale: 17
days-before-close: 3
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ci:
autoupdate_branch: "dev"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -13,7 +16,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.3.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"kevinrose.vsc-python-indent",
"charliermarsh.ruff",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2024-03-28

- v24.3.4
- 인페인트에서, 이미지 해상도가 16의 배수가 아닐 때 사이즈 불일치로 인한 opencv 에러 방지

## 2024-03-25

- v24.3.3
Expand Down
6 changes: 5 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ tasks:

update:
cmds:
- "{{.PYTHON}} -m pip install -U ultralytics mediapipe ruff pre-commit black"
- "{{.PYTHON}} -m pip install -U ultralytics mediapipe ruff pre-commit black devtools pytest"

update-torch:
cmds:
- "{{.PYTHON}} -m pip install -U torch torchvision torchaudio -f https://download.pytorch.org/whl/torch_stable.html"
2 changes: 1 addition & 1 deletion adetailer/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "24.3.3"
__version__ = "24.3.4"
2 changes: 2 additions & 0 deletions scripts/!adetailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ def is_inpaint_only_masked(p) -> bool:
def inpaint_mask_filter(
img2img_mask: Image.Image, ad_mask: list[Image.Image]
) -> list[Image.Image]:
if ad_mask and img2img_mask.size != ad_mask[0].size:
img2img_mask = img2img_mask.resize(ad_mask[0].size, resample=images.LANCZOS)
return [mask for mask in ad_mask if has_intersection(img2img_mask, mask)]

@staticmethod
Expand Down
21 changes: 5 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
from functools import cache

import pytest
import requests
from PIL import Image


@cache
def _sample_image():
url = "https://i.imgur.com/E5OVXvn.png"
resp = requests.get(url, stream=True, headers={"User-Agent": "Mozilla/5.0"})
return Image.open(resp.raw)


@cache
def _sample_image2():
url = "https://i.imgur.com/px5UT7T.png"
def get_image(url: str) -> Image.Image:
resp = requests.get(url, stream=True, headers={"User-Agent": "Mozilla/5.0"})
return Image.open(resp.raw)


@pytest.fixture()
@pytest.fixture(scope="session")
def sample_image():
return _sample_image()
return get_image("https://i.imgur.com/E5OVXvn.png")


@pytest.fixture()
@pytest.fixture(scope="session")
def sample_image2():
return _sample_image2()
return get_image("https://i.imgur.com/px5UT7T.png")
Loading

0 comments on commit 372e8b7

Please sign in to comment.