Skip to content

Commit

Permalink
chore: add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBlenny committed Jun 9, 2022
1 parent 7d75b81 commit e6b54d8
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 6 deletions.
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending
- id: trailing-whitespace
- id: fix-byte-order-marker

# Python hooks
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: [--py36-plus]

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ["--line-length=99"]

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
args: ["--ignore=E203, E266, E501, W503, F403, F401 --max-line-length = 99"]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nuctl deploy --project-name cvat \

### Get started

In order to develop you'll want a nuclio instance running on your local machine...
In order to develop you'll want a nuclio instance running on your local machine...

* `docker-compose up` to start nuclio.
* `./scripts/build.sh` to build `ghcr.io/greenroom-robotics/nuclio_lighting_flash:latest`
Expand All @@ -30,6 +30,10 @@ nuctl deploy --project-name cvat \
--platform local
```

### Run tests

* `./scripts/build.sh && docker run ghcr.io/greenroom-robotics/nuclio_lighting_flash:latest` to build and run pytests

### Release a version

* Run the [Release](./.github/workflows/release.yml) workflow on github
2 changes: 1 addition & 1 deletion nuclio_lighting_flash/flash_model_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ def infer(self, image: Image, threshold: float = 0.0):
)
if predictions is None:
return []
return predictions[0][0]
return predictions[0][0]
1 change: 0 additions & 1 deletion nuclio_lighting_flash/flash_model_handler_in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from flash.core.data.io.output import Output
from flash.core.data.io.input import DataKeys
from flash.core.data.data_module import DataModule
from flash.core.data.io.input import DataKeys
from flash.core.data.io.output_transform import OutputTransform
from flash.core.trainer import Trainer
from flash.core.utilities.stages import RunningStage
Expand Down
4 changes: 1 addition & 3 deletions nuclio_lighting_flash/nuclio_detection_labels_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def transform(self, sample: Dict[str, Any]) -> List[Dict[str, Any]]:

preds = sample[DataKeys.PREDS]

for bbox, label, score in zip(
preds["bboxes"], preds["labels"], preds["scores"]
):
for bbox, label, score in zip(preds["bboxes"], preds["labels"], preds["scores"]):
confidence = score.tolist()

if self.threshold is not None and confidence < self.threshold:
Expand Down

0 comments on commit e6b54d8

Please sign in to comment.