Skip to content

Commit

Permalink
ready 1.3.0 release + various DevOps enhancements (#25)
Browse files Browse the repository at this point in the history
* adding pre-commit standard js

* Add model reload feature (#24)

* add reload functionality

* Document reload functionality

* version bump

* better handling of msg.reload & empty payload

* updated doc re: reload function

* Update teachable_machine.html

Co-authored-by: Yair Bonastre <[email protected]>

* Update package.json

Co-authored-by: Yair Bonastre <[email protected]>

Co-authored-by: Yair Bonastre <[email protected]>

* add pre-commit checks

* add dependabot

* add ci

* upgrade npm packages

* fixing changelog links

* update example

* proper import

* improve badges

* final changelog changes before release

* fix ci only on push to main and pull requests

Co-authored-by: Jacek <[email protected]>
  • Loading branch information
bonastreyair and acejacek authored Sep 24, 2021
1 parent 7d52747 commit 0fe6b7a
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 130 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
23 changes: 12 additions & 11 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Publish npm package

on:
Expand All @@ -8,14 +9,14 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup node
uses: actions/[email protected]
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Publish npm package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup node
uses: actions/[email protected]
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Publish npm package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
14 changes: 12 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
- id: check-json
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys']
args: [--autofix, --no-sort-keys]
- repo: https://github.com/standard/standard
rev: v16.0.3
hooks:
- id: standard
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.1.0
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0']
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.10
hooks:
- id: mdformat
79 changes: 47 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@

All notable changes to this project will be documented in this file.

## [1.3.0] - 2021-09-24

### Added

- Model reload option flag during running time - [#22](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/22) - Thanks [@acejacek](https://github.com/acejacek) for the suggestion and the PR
- `pre-commit` common checks with `standard`, `yamlfmt` and `mdformat` style checks
- GitHub Actions **CI** test with badge
- **npm** quality badge to the `README` file
- Automatic dependency checks with **dependabot**

### Changed

- Upgraded `node-fetch` to version `3.0.0`
- Upgraded `pureimage` to version `0.3.5`
- Upgraded `package-lock.json` file format to `v7`
- Updated the `basic` example with the new reload option flag

## [1.2.2] - 2020-10-24

### Changed

- Upgraded to `@tensorflow/tfjs-node v1.4.0` to help Raspberry Pi installation - [#18](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/18)
- Upgraded `@tensorflow/tfjs-node` to version `1.4.0` to help Raspberry Pi installation - [#18](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/18)

## [1.2.1] - 2020-10-24

Expand All @@ -25,8 +42,8 @@ All notable changes to this project will be documented in this file.

- Compatibility with official Node-RED Dockerized image based on [Alpine](https://hub.docker.com/_/alpine) image
- Compatibility with Raspberry Pi
- [`pureimage`](https://www.npmjs.com/package/pureimage) npm package dependency to manage buffer images using pure javascript - [#17](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/17)
- [`node-fetch`](https://www.npmjs.com/package/node-fetch) npm package dependency to manage http request to obtain the model info
- `pureimage` npm package dependency to manage buffer images using pure javascript - [#17](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/17)
- `node-fetch` npm package dependency to manage http request to obtain the model info

### Removed

Expand Down Expand Up @@ -63,7 +80,7 @@ All notable changes to this project will be documented in this file.

### Changed

- Dependancy is now `@tensorflow/tfjs v1.3.1` instead of `@tensorflow/tfjs-node v1.4.0`, to match teachable machine correct dependencies
- Dependancy is now `@tensorflow/tfjs 1.3.1` instead of `@tensorflow/tfjs-node 1.4.0`, to match teachable machine correct dependencies

## [1.1.2] - 2020-05-03

Expand Down Expand Up @@ -98,7 +115,7 @@ All notable changes to this project will be documented in this file.

- Updated image on how to use Teachable Machine and configuration node on Step 3
- Use standard image treatment for `README` instead of HTML
- Upgraded to `@tensorflow/tfjs-node v1.4.0` to enable coexistantce with [tfjs-nodes](https://github.com/dceejay/tfjs-nodes) nodes - [#8](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/8)
- Upgraded `@tensorflow/tfjs-node` to version `1.4.0` to enable coexistantce with [tfjs-nodes](https://github.com/dceejay/tfjs-nodes) nodes - [#8](https://github.com/bonastreyair/node-red-contrib-teachable-machine/issues/8)

## [1.0.1] - 2020-04-15

Expand All @@ -121,7 +138,7 @@ All notable changes to this project will be documented in this file.

### Changed

- Icon updated to Tensorflow 2.0 new logo
- Icon updated to **Tensorflow 2.0** new logo
- Updated configuration node
- Using all `README` badges from [Shields.io](https://shields.io/)
- Outputs is always an array of results even if `Best prediction` is selected
Expand Down Expand Up @@ -162,24 +179,7 @@ All notable changes to this project will be documented in this file.

### Changed

- Downgraded `@tensorflow/tfjs-node` from version `v1.4.0` to `v1.3.1` for better compatibility
- Output has changed from `checkbox` to a `list`, you can now select `Best predictions` or `All predictions`
- Code cleaning

### Fixed

- WebGL loading error in JSDOM
- When installing the node -> `npm WARN @teachablemachine/[email protected] requires a peer of @tensorflow/[email protected] but none is installed`

## [0.1.1] - 2020-04-11

### Added

- Comments in the code

### Changed

- Downgraded `@tensorflow/tfjs-node` from version `v1.4.0` to `v1.3.1` for better compatibility
- Downgraded `@tensorflow/tfjs-node` from version `1.4.0` to `1.3.1` for better compatibility
- Output has changed from `checkbox` to a `list`, you can now select `Best predictions` or `All predictions`
- Code cleaning

Expand All @@ -188,14 +188,29 @@ All notable changes to this project will be documented in this file.
- WebGL loading error in JSDOM
- When installing the node -> `npm WARN @teachablemachine/[email protected] requires a peer of @tensorflow/[email protected] but none is installed`

## [0.1.0] - 2020-04-11
## 0.1.0 - 2020-04-11

### Added

- Functional using Teachable Machine Online Model URL
- Option to select Top-1 or all results
- CHANGELOG.md file
- README.md file

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Functional using **Teachable Machine** Online Model URL
- Option to select **Top-1** or all results
- `CHANGELOG.md` file
- `README.md` file

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[0.1.1]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v0.1.0...v0.1.1
[0.1.2]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v0.1.1...v0.1.2
[0.1.3]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v0.1.2...v0.1.3
[1.0.0]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v0.1.3...v1.0.0
[1.0.1]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.0.0...v1.0.1
[1.1.0]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.0.1...v1.1.0
[1.1.1]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.0...v1.1.1
[1.1.2]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.1...v1.1.2
[1.1.3]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.2...v1.1.3
[1.1.4]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.3...v1.1.4
[1.1.5]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.4...v1.1.5
[1.2.0]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.1.5...v1.2.0
[1.2.1]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.2.0...v1.2.1
[1.2.2]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.2.1...v1.2.2
[1.3.0]: https://github.com/bonastreyair/node-red-contrib-teachable-machine/compare/v1.2.2...v1.3.0
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# node-red-contrib-teachable-machine

[![Platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/bonastreyair/node-red-contrib-teachable-machine)](https://github.com/bonastreyair/node-red-contrib-teachable-machine/blob/master/CHANGELOG.md)
[![npm total downloads](https://img.shields.io/npm/dt/node-red-contrib-teachable-machine)](https://www.npmjs.com/package/node-red-contrib-teachable-machine)
<br>[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![GitHub license](https://img.shields.io/github/license/bonastreyair/node-red-contrib-teachable-machine)](https://github.com/bonastreyair/node-red-contrib-teachable-machine/blob/master/LICENSE)
[![donate PayPal](https://img.shields.io/badge/donate-PayPal-blue)](https://www.paypal.me/bonastreyair)
[![Node-RED node](https://img.shields.io/badge/Node--RED-node-red?logo=node-red&style=flat-square)](https://nodered.org)
[![Test CI](https://img.shields.io/github/workflow/status/bonastreyair/node-red-contrib-teachable-machine/CI?label=test&logo=github&style=flat-square)](https://github.com/duhow/download-github-release-assets/actions?workflow=CI)
[![npm latest release](https://img.shields.io/npm/v/node-red-contrib-teachable-machine?logo=npm&style=flat-square)](https://www.npmjs.com/package/node-red-contrib-teachable-machine)
[![npm total downloads](https://img.shields.io/npm/dt/node-red-contrib-teachable-machine?style=flat-square)](https://www.npmjs.com/package/node-red-contrib-teachable-machine)
[![Package Quality](https://packagequality.com/shield/node-red-contrib-teachable-machine.svg?style=flat-square)](https://packagequality.com/#?package=node-red-contrib-teachable-machine)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square&color=yellow)](https://standardjs.com)
[![GitHub license](https://img.shields.io/github/license/bonastreyair/node-red-contrib-teachable-machine?style=flat-square&color=blue)](https://github.com/bonastreyair/node-red-contrib-teachable-machine/blob/master/LICENSE)
[![donate PayPal](https://img.shields.io/badge/donate-PayPal-blue?style=flat-square)](https://www.paypal.me/bonastreyair)

A [Node-RED](https://nodered.org) node based in [tensorflow.js](https://www.tensorflow.org/js) that enables to run custom image classification trained models using [Teachable Machine](https://teachablemachine.withgoogle.com/train/image) tool.

<p align="center">
<img src="https://user-images.githubusercontent.com/37800834/79343223-736d7d80-7f2e-11ea-9c85-b83fc73b0952.png" height="70">
<img src="https://user-images.githubusercontent.com/37800834/79343223-736d7d80-7f2e-11ea-9c85-b83fc73b0952.png" height="70">
</p>

## Install
Expand All @@ -22,7 +24,7 @@ You have two options to install the node.

- Run the following command in your `Node-RED` user directory - typically `~/.node-red`

``` bash
```bash
npm install node-red-contrib-teachable-machine
```

Expand Down Expand Up @@ -54,9 +56,10 @@ In `Node-RED` send a buffered image to the node. Check the example in the `Impor

## Requirements

- `Node-RED v1.0.0+`
- `Node-RED v2.0.0+`
- `Node.js v12.20.0+`

*Note:* MacOSX Catalina, Windows 10 and Ubuntu 18.04 are supported as well as using official `docker nodered/node-red` [image](https://hub.docker.com/r/nodered/node-red/) based on [Alpine](https://hub.docker.com/_/alpine) image. Works with Raspberry Pi too since release [`v1.2.0+`](https://github.com/bonastreyair/node-red-contrib-teachable-machine/tags).
*Note:* MacOSX, Windows 10 and Ubuntu 18.04+ are supported as well as using official `docker nodered/node-red` [image](https://hub.docker.com/r/nodered/node-red/) based on [Alpine](https://hub.docker.com/_/alpine) image. Works with Raspberry Pi too since release [`v1.2.0+`](https://github.com/bonastreyair/node-red-contrib-teachable-machine/tags).

## Mentions

Expand Down
Loading

0 comments on commit 0fe6b7a

Please sign in to comment.