-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from gianlucamazza/develop
cleanup
- Loading branch information
Showing
38 changed files
with
2,122 additions
and
929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203, E266, E501, W503, W293, E302 | ||
max-complexity = 18 | ||
select = B,C,E,F,W,T4,B9 | ||
exclude = | ||
.git, | ||
__pycache__, | ||
docs/source/conf.py, | ||
old, | ||
build, | ||
dist, | ||
venv | ||
|
||
per-file-ignores = | ||
# imported but unused | ||
__init__.py: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Python Code Quality | ||
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main, develop] | ||
|
||
jobs: | ||
code-quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 black | ||
- name: Run Flake8 | ||
run: flake8 src tests | ||
- name: Run Black | ||
run: black --check src tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ src/__pycache__/ | |
src/*.egg-info/ | ||
build/ | ||
|
||
# Distribution / packaging | ||
node_modules/ | ||
|
||
# virtualenv | ||
venv/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v4.0.0-alpha.8" | ||
hooks: | ||
- id: prettier | ||
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,57 @@ | ||
[build-system] | ||
requires = ["setuptools>=64", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.black] | ||
line-length = 79 | ||
target-version = ['py38'] | ||
include = '\.pyi?$' | ||
extend-exclude = ''' | ||
/( | ||
# directories | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
| build | ||
| dist | ||
| node_modules | ||
| data | ||
| docs | ||
| logs | ||
| models | ||
| png | ||
| reports | ||
| static | ||
)/ | ||
''' | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 79 | ||
multi_line_output = 3 | ||
include_trailing_comma = true | ||
force_grid_wrap = 0 | ||
use_parentheses = true | ||
ensure_newline_before_comments = true | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = "-ra -q" | ||
testpaths = [ | ||
"tests", | ||
] | ||
|
||
[tool.mypy] | ||
python_version = "3.8" | ||
warn_return_any = true | ||
warn_unused_configs = true | ||
ignore_missing_imports = true | ||
|
||
[tool.pylint.messages_control] | ||
disable = "C0330, C0326" | ||
|
||
[tool.pylint.format] | ||
max-line-length = "79" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,7 @@ optuna | |
onnxruntime | ||
onnx | ||
flask | ||
pytest | ||
pytest | ||
black | ||
flake8 | ||
pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
from flask import Flask | ||
from .config import Config | ||
from flask import Flask | ||
|
||
|
||
def create_app(config_class=Config): | ||
app = Flask(__name__) | ||
app.config.from_object(config_class) | ||
|
||
from api.routes import main | ||
|
||
app.register_blueprint(main) | ||
|
||
return app | ||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | ||
|
||
from api import create_app | ||
|
||
app = create_app() | ||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) | ||
if __name__ == "__main__": | ||
app.run(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import os | ||
|
||
|
||
class Config: | ||
MODEL_PATH = os.environ.get('MODEL_PATH') or 'models/best_model.onnx' | ||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' | ||
# Add other configuration variables as needed | ||
MODEL_PATH = os.environ.get("MODEL_PATH") or "models/best_model.onnx" | ||
SECRET_KEY = os.environ.get("SECRET_KEY") or "you-will-never-guess" | ||
# Add other configuration variables as needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import os | ||
import sys | ||
import onnxruntime as ort | ||
import numpy as np | ||
|
||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | ||
|
||
from api.config import Config | ||
|
||
|
||
def load_model(): | ||
return ort.InferenceSession(Config.MODEL_PATH) | ||
|
||
|
||
def make_prediction(model, data): | ||
ort_inputs = {model.get_inputs()[0].name: data} | ||
return model.run(None, ort_inputs)[0] | ||
return model.run(None, ort_inputs)[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.