Spaces:
Running on Zero
Running on Zero
Update
Browse filesFiles changed (4)
- .pre-commit-config.yaml+59-35
- .style.yapfDeleted-5
- app.py+5-5
- model.py+3-5
123456789101112131415161718192021222324252627282930313233343536exclude: ^MangaLineExtraction_PyTorchrepos:- repo: https://github.com/pre-commit/pre-commit-hooksrev: v4.2.0hooks:- id: check-executables-have-shebangs- id: check-json- id: check-merge-conflict- id: check-shebang-scripts-are-executable- id: check-toml- id: check-yaml- id: double-quote-string-fixer- id: end-of-file-fixer- id: mixed-line-endingargs: ['--fix=lf']- id: requirements-txt-fixer- id: trailing-whitespace- repo: https://github.com/myint/docformatterrev: v1.4hooks:- id: docformatterargs: ['--in-place']- repo: https://github.com/pycqa/isortrev: 5.12.0hooks:- id: isort- repo: https://github.com/pre-commit/mirrors-mypyrev: v0.991hooks:- id: mypyargs: ['--ignore-missing-imports']- repo: https://github.com/google/yapfrev: v0.32.0hooks:- id: yapfargs: ['--parallel', '--in-place']123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960repos:- repo: https://github.com/pre-commit/pre-commit-hooksrev: v4.6.0hooks:- id: check-executables-have-shebangs- id: check-json- id: check-merge-conflict- id: check-shebang-scripts-are-executable- id: check-toml- id: check-yaml- id: end-of-file-fixer- id: mixed-line-endingargs: ["--fix=lf"]- id: requirements-txt-fixer- id: trailing-whitespace- repo: https://github.com/myint/docformatterrev: v1.7.5hooks:- id: docformatterargs: ["--in-place"]- repo: https://github.com/pycqa/isortrev: 5.13.2hooks:- id: isortargs: ["--profile", "black"]- repo: https://github.com/pre-commit/mirrors-mypyrev: v1.10.0hooks:- id: mypyargs: ["--ignore-missing-imports"]additional_dependencies:["types-python-slugify","types-requests","types-PyYAML","types-pytz",]- repo: https://github.com/psf/blackrev: 24.4.2hooks:- id: blacklanguage_version: python3.10args: ["--line-length", "119"]- repo: https://github.com/kynan/nbstripoutrev: 0.7.1hooks:- id: nbstripoutargs:["--extra-keys","metadata.interpreter metadata.kernelspec cell.metadata.pycharm",]- repo: https://github.com/nbQA-dev/nbQArev: 1.8.5hooks:- id: nbqa-black- id: nbqa-pyupgradeargs: ["--py37-plus"]- id: nbqa-isortargs: ["--float-to-top"]
12345[style]based_on_style = pep8blank_line_before_nested_class_or_def = falsespaces_before_comment = 2split_before_logical_operator = true5 unmodified lines6789101112131415161718192021225 unmodified linesfrom model import ModelDESCRIPTION = '# [MangaLineExtraction_PyTorch](https://github.com/ljsabc/MangaLineExtraction_PyTorch)'model = Model()with gr.Blocks(css='style.css') as demo:gr.Markdown(DESCRIPTION)with gr.Row():with gr.Column():input_image = gr.Image(label='Input', type='numpy')run_button = gr.Button(value='Run')with gr.Column():result = gr.Image(label='Result', type='numpy', elem_id='result')run_button.click(fn=model.predict, inputs=input_image, outputs=result)demo.queue().launch()5 unmodified lines6789101112131415161718192021225 unmodified linesfrom model import ModelDESCRIPTION = "# [MangaLineExtraction_PyTorch](https://github.com/ljsabc/MangaLineExtraction_PyTorch)"model = Model()with gr.Blocks(css="style.css") as demo:gr.Markdown(DESCRIPTION)with gr.Row():with gr.Column():input_image = gr.Image(label="Input", type="numpy")run_button = gr.Button(value="Run")with gr.Column():result = gr.Image(label="Result", type="numpy", elem_id="result")run_button.click(fn=model.predict, inputs=input_image, outputs=result)demo.queue().launch()
9 unmodified lines101112131415163 unmodified lines202122232425262728293031329 unmodified linesimport torch.nn as nncurrent_dir = pathlib.Path(__file__).parentsubmodule_dir = current_dir / 'MangaLineExtraction_PyTorch'sys.path.insert(0, submodule_dir.as_posix())from model_torch import res_skip3 unmodified linesclass Model:def __init__(self):self.device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')self.model = self._load_model()def _load_model(self) -> nn.Module:ckpt_path = huggingface_hub.hf_hub_download('public-data/MangaLineExtraction_PyTorch', 'erika.pth')state_dict = torch.load(ckpt_path)model = res_skip()model.load_state_dict(state_dict)9 unmodified lines101112131415163 unmodified lines20212223242526272829309 unmodified linesimport torch.nn as nncurrent_dir = pathlib.Path(__file__).parentsubmodule_dir = current_dir / "MangaLineExtraction_PyTorch"sys.path.insert(0, submodule_dir.as_posix())from model_torch import res_skip3 unmodified linesclass Model:def __init__(self):self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")self.model = self._load_model()def _load_model(self) -> nn.Module:ckpt_path = huggingface_hub.hf_hub_download("public-data/MangaLineExtraction_PyTorch", "erika.pth")state_dict = torch.load(ckpt_path)model = res_skip()model.load_state_dict(state_dict)
.pre-commit-config.yaml+59-35
.style.yapfDeleted-5
app.py+5-5
model.py+3-5