Spaces:
Sleeping
Sleeping
Commit
·
32a1cbe
1
Parent(s):
d3cab6f
merge from origin repo
Browse files- .pre-commit-config.yaml +59 -35
- .vscode/settings.json +23 -11
- app.py +4 -3
.pre-commit-config.yaml
CHANGED
@@ -1,36 +1,60 @@
|
|
1 |
repos:
|
2 |
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
- repo: https://github.com/pre-commit/mirrors-mypy
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
repos:
|
2 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3 |
+
rev: v4.5.0
|
4 |
+
hooks:
|
5 |
+
- id: check-executables-have-shebangs
|
6 |
+
- id: check-json
|
7 |
+
- id: check-merge-conflict
|
8 |
+
- id: check-shebang-scripts-are-executable
|
9 |
+
- id: check-toml
|
10 |
+
- id: check-yaml
|
11 |
+
- id: end-of-file-fixer
|
12 |
+
- id: mixed-line-ending
|
13 |
+
args: ["--fix=lf"]
|
14 |
+
- id: requirements-txt-fixer
|
15 |
+
- id: trailing-whitespace
|
16 |
+
- repo: https://github.com/myint/docformatter
|
17 |
+
rev: v1.7.5
|
18 |
+
hooks:
|
19 |
+
- id: docformatter
|
20 |
+
args: ["--in-place"]
|
21 |
+
- repo: https://github.com/pycqa/isort
|
22 |
+
rev: 5.13.2
|
23 |
+
hooks:
|
24 |
+
- id: isort
|
25 |
+
args: ["--profile", "black"]
|
26 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
27 |
+
rev: v1.8.0
|
28 |
+
hooks:
|
29 |
+
- id: mypy
|
30 |
+
args: ["--ignore-missing-imports"]
|
31 |
+
additional_dependencies:
|
32 |
+
[
|
33 |
+
"types-python-slugify",
|
34 |
+
"types-requests",
|
35 |
+
"types-PyYAML",
|
36 |
+
"types-pytz",
|
37 |
+
]
|
38 |
+
- repo: https://github.com/psf/black
|
39 |
+
rev: 24.2.0
|
40 |
+
hooks:
|
41 |
+
- id: black
|
42 |
+
language_version: python3.10
|
43 |
+
args: ["--line-length", "119"]
|
44 |
+
- repo: https://github.com/kynan/nbstripout
|
45 |
+
rev: 0.7.1
|
46 |
+
hooks:
|
47 |
+
- id: nbstripout
|
48 |
+
args:
|
49 |
+
[
|
50 |
+
"--extra-keys",
|
51 |
+
"metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
|
52 |
+
]
|
53 |
+
- repo: https://github.com/nbQA-dev/nbQA
|
54 |
+
rev: 1.7.1
|
55 |
+
hooks:
|
56 |
+
- id: nbqa-black
|
57 |
+
- id: nbqa-pyupgrade
|
58 |
+
args: ["--py37-plus"]
|
59 |
+
- id: nbqa-isort
|
60 |
+
args: ["--float-to-top"]
|
.vscode/settings.json
CHANGED
@@ -1,18 +1,30 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
"
|
4 |
-
"python.linting.pylintEnabled": false,
|
5 |
-
"python.linting.lintOnSave": true,
|
6 |
-
"python.formatting.provider": "yapf",
|
7 |
-
"python.formatting.yapfArgs": [
|
8 |
-
"--style={based_on_style: pep8, indent_width: 4, blank_line_before_nested_class_or_def: false, spaces_before_comment: 2, split_before_logical_operator: true}"
|
9 |
-
],
|
10 |
"[python]": {
|
|
|
11 |
"editor.formatOnType": true,
|
12 |
"editor.codeActionsOnSave": {
|
13 |
-
"source.organizeImports":
|
14 |
}
|
15 |
},
|
16 |
-
"
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
|
|
1 |
{
|
2 |
+
"editor.formatOnSave": true,
|
3 |
+
"files.insertFinalNewline": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
"[python]": {
|
5 |
+
"editor.defaultFormatter": "ms-python.black-formatter",
|
6 |
"editor.formatOnType": true,
|
7 |
"editor.codeActionsOnSave": {
|
8 |
+
"source.organizeImports": "explicit"
|
9 |
}
|
10 |
},
|
11 |
+
"[jupyter]": {
|
12 |
+
"files.insertFinalNewline": false
|
13 |
+
},
|
14 |
+
"black-formatter.args": [
|
15 |
+
"--line-length=119"
|
16 |
+
],
|
17 |
+
"isort.args": ["--profile", "black"],
|
18 |
+
"flake8.args": [
|
19 |
+
"--max-line-length=119"
|
20 |
+
],
|
21 |
+
"ruff.lint.args": [
|
22 |
+
"--line-length=119"
|
23 |
+
],
|
24 |
+
"notebook.output.scrolling": true,
|
25 |
+
"notebook.formatOnCellExecution": true,
|
26 |
+
"notebook.formatOnSave.enabled": true,
|
27 |
+
"notebook.codeActionsOnSave": {
|
28 |
+
"source.organizeImports": "explicit"
|
29 |
+
}
|
30 |
}
|
app.py
CHANGED
@@ -10,7 +10,7 @@ from cropImage import cropImage
|
|
10 |
from checkIgnore import is_ignore
|
11 |
from createTagDom import create_tag_dom
|
12 |
|
13 |
-
def predict(image: PIL.Image.Image, score_threshold: float):
|
14 |
result_threshold = genTag(image, score_threshold)
|
15 |
result_html = ''
|
16 |
for label, prob in result_threshold.items():
|
@@ -49,7 +49,7 @@ with gr.Blocks(css="style.css", js="script.js") as demo:
|
|
49 |
maximum=1,
|
50 |
step=0.1,
|
51 |
value=0.3)
|
52 |
-
run_button = gr.Button('Run')
|
53 |
with gr.Accordion(label="Crop Image", open=False):
|
54 |
crop_image = gr.Image(elem_classes='m5dd_image2',
|
55 |
format='jpg',
|
@@ -90,4 +90,5 @@ with gr.Blocks(css="style.css", js="script.js") as demo:
|
|
90 |
api_name='predict_batch',
|
91 |
)
|
92 |
|
93 |
-
|
|
|
|
10 |
from checkIgnore import is_ignore
|
11 |
from createTagDom import create_tag_dom
|
12 |
|
13 |
+
def predict(image: PIL.Image.Image, score_threshold: float):
|
14 |
result_threshold = genTag(image, score_threshold)
|
15 |
result_html = ''
|
16 |
for label, prob in result_threshold.items():
|
|
|
49 |
maximum=1,
|
50 |
step=0.1,
|
51 |
value=0.3)
|
52 |
+
run_button = gr.Button('Run')
|
53 |
with gr.Accordion(label="Crop Image", open=False):
|
54 |
crop_image = gr.Image(elem_classes='m5dd_image2',
|
55 |
format='jpg',
|
|
|
90 |
api_name='predict_batch',
|
91 |
)
|
92 |
|
93 |
+
if __name__ == "__main__":
|
94 |
+
demo.queue(max_size=20).launch()
|