Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
My12123 authored Dec 18, 2024
2 parents 1c2d724 + 3b4e4ad commit fdf7eba
Show file tree
Hide file tree
Showing 99 changed files with 7,433 additions and 7,582 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ __pycache__
ocrs
models/*
test/testdata/bboxes
/venv
.git
93 changes: 47 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
name: CI

on:
push:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'poetry.lock'
pull_request:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'poetry.lock'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
poetry-version: [1.6.1]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry install --only main,test
- name: Lint *.py files
run: |
poetry run pylint $(git ls-files '*.py')
# - name: Test
# run: |
# poetry run pytest test
name: CI

on:
push:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'requirements-dev.txt'
pull_request:
branches: [main]
paths:
- '.github/workflows/ci.yml'
- 'manga_translator/**'
- 'test/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'requirements-dev.txt'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -mvenv venv
venv/bin/pip install -r requirements.txt -r requirements-dev.txt
- name: Test
run: |
venv/bin/pytest test
timeout-minutes: 5
- name: Lint *.py files
run: |
venv/bin/pylint $(git ls-files '*.py')
if: always()
continue-on-error: true # to not fail CI on lint errors
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,28 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
if: github.repository == 'zyddnys/manga-image-translator'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v2
with:
images: zyddnys/manga-image-translator

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
.history
/venv

# Input and Output
/input/
/input-translated/
27 changes: 12 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
FROM pytorch/pytorch:latest
FROM pytorch/pytorch:2.5.1-cuda11.8-cudnn9-runtime

WORKDIR /app
# not apt update: most effective code in pytorch base image is in /opt/conda

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
# Assume root to install required dependencies
RUN apt-get install -y git g++ ffmpeg libsm6 libxext6 libvulkan-dev && \
pip install git+https://github.com/kodalli/pydensecrf.git
WORKDIR /app

# Install pip dependencies

COPY requirements.txt /app/requirements.txt

RUN pip install -r /app/requirements.txt
RUN pip install torchvision --force-reinstall

RUN apt-get remove -y g++ && \
apt-get autoremove -y
RUN export TZ=Etc/UTC ; \
apt update --yes \
&& apt install g++ ffmpeg libsm6 libxext6 --yes \
&& pip install -r /app/requirements.txt \
&& apt remove g++ --yes \
&& apt autoremove --yes \
&& rm -rf /var/cache/apt

# Copy app
COPY . /app

# Prepare models
RUN python -u docker_prepare.py
RUN python -u docker_prepare.py --continue-on-error

RUN rm -rf /tmp

# Add /app to Python module path
ENV PYTHONPATH="${PYTHONPATH}:/app"
ENV PYTHONPATH="/app"

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ run-web-server:
--manga2eng \
--verbose \
--mode=web \
--use-cuda \
--use-gpu \
--host=0.0.0.0 \
--port=5003
Loading

0 comments on commit fdf7eba

Please sign in to comment.