[OV JS] Port of Fix npm dependencies (#22830)
Port of: https://github.com/openvinotoolkit/openvino/pull/22810 To fix this issue: https://github.com/openvinotoolkit/openvino/security/dependabot/514
This commit is contained in:
parent
4bf8a469dc
commit
b03c36fee3
|
|
@ -1,6 +1,6 @@
|
|||
# OpenVINO™ JavaScript API examples of usage
|
||||
|
||||
## Installation of openvinojs-node package
|
||||
## Installation of openvino-node package
|
||||
From *openvino/src/bindings/js/node* run `npm i` to download OpenVINO™ runtime, install requirements, build bindings and compile TypeScript code to JavaScript
|
||||
|
||||
On the *.nix systems run `source openvino/src/bindings/js/node/scripts/setupvars.sh` to add path to OpenVINO™ runtime libraries in `LD_LIBRARY_PATH` variable
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { addon: ov } = require('openvinojs-node');
|
||||
const { addon: ov } = require('openvino-node');
|
||||
|
||||
const args = require('args');
|
||||
const { cv } = require('opencv-wasm');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { addon: ov } = require('openvinojs-node');
|
||||
const { addon: ov } = require('openvino-node');
|
||||
|
||||
const { cv } = require('opencv-wasm');
|
||||
const { getImageData } = require('../helpers.js');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { addon: ov } = require('openvinojs-node');
|
||||
const { addon: ov } = require('openvino-node');
|
||||
|
||||
const fs = require('node:fs/promises');
|
||||
const { cv } = require('opencv-wasm');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
"language": "javascript",
|
||||
"source": [
|
||||
"const { cv } = require('opencv-wasm');\nconst { display } = require('node-kernel');\nconst { getImageData, displayImage, downloadFile } = require('../helpers.js');\n\nconst { addon: ov } = require('openvinojs-node');\n"
|
||||
"const { cv } = require('opencv-wasm');\nconst { display } = require('node-kernel');\nconst { getImageData, displayImage, downloadFile } = require('../helpers.js');\n\nconst { addon: ov } = require('openvino-node');\n"
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
|
|
@ -39,8 +39,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/models/v3-small_224_1.0_float.bin'",
|
||||
""
|
||||
]
|
||||
|
|
@ -67,8 +65,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/datasets/imagenet_class_index.json'",
|
||||
""
|
||||
]
|
||||
|
|
@ -162,4 +158,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
"language": "typescript",
|
||||
"source": [
|
||||
"const {\n getImageData, \n displayArrayAsImage, \n arrayToImageData,\n transform,\n downloadFile,\n} = require('../helpers');\n\nconst { cv } = require('opencv-wasm');\nconst { display } = require('node-kernel');\n\nconst { addon: ov } = require('openvinojs-node'); \n"
|
||||
"const {\n getImageData, \n displayArrayAsImage, \n arrayToImageData,\n transform,\n downloadFile,\n} = require('../helpers');\n\nconst { cv } = require('opencv-wasm');\nconst { display } = require('node-kernel');\n\nconst { addon: ov } = require('openvino-node'); \n"
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
|
|
@ -39,8 +39,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/models/road-segmentation-adas-0001.bin'",
|
||||
""
|
||||
]
|
||||
|
|
@ -67,7 +65,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/images/empty_road_mapillary.jpg'",
|
||||
""
|
||||
]
|
||||
|
|
@ -160,4 +157,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
"language": "javascript",
|
||||
"source": [
|
||||
"const {\n exp,\n sum,\n tril,\n triu,\n argMax,\n reshape,\n getShape,\n downloadFile,\n extractValues,\n matrixMultiplication,\n} = require('../helpers.js');\nconst tokens = require('./tokens_bert.js');\n\nconst { addon: ov } = require('openvinojs-node'); \n"
|
||||
"const {\n exp,\n sum,\n tril,\n triu,\n argMax,\n reshape,\n getShape,\n downloadFile,\n extractValues,\n matrixMultiplication,\n} = require('../helpers.js');\nconst tokens = require('./tokens_bert.js');\n\nconst { addon: ov } = require('openvino-node'); \n"
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
|
|
@ -39,8 +39,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/models/bert-small-uncased-whole-word-masking-squad-int8-0002.bin'",
|
||||
""
|
||||
]
|
||||
|
|
@ -67,7 +65,6 @@
|
|||
{
|
||||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Proxy agent configured using: 'http://proxy-mu.intel.com:911'",
|
||||
"File successfully stored at '/home/nvishnya/Code/wasm-openvino/samples/js/assets/text/vocab.txt'",
|
||||
""
|
||||
]
|
||||
|
|
@ -212,10 +209,8 @@
|
|||
"mime": "application/vnd.code.notebook.stdout",
|
||||
"value": [
|
||||
"Context: Computational complexity theory is a branch of the theory of computation in theoretical computer science that focuses on classifying computational problems according to their inherent difficulty, and relating those classes to each other. A computational problem is understood to be a task that is in principle amenable to being solved by a computer, which is equivalent to stating that the problem may be solved by mechanical application of mathematical steps, such as an algorithm.",
|
||||
"Question: What is the term for a task that generally lends itself to being solved by a computer?",
|
||||
"Answer: A computational problem",
|
||||
"Score: 0.5286847737759395",
|
||||
"Time: 0.045163961s",
|
||||
"Time: 0.045750747s",
|
||||
""
|
||||
]
|
||||
}
|
||||
|
|
@ -224,4 +219,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "openvinojs-node-demo",
|
||||
"name": "openvino-node-demo",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"eslint": "^8.39.0",
|
||||
"https-proxy-agent": "^7.0.2",
|
||||
"opencv-wasm": "^4.3.0-10",
|
||||
"openvinojs-node": "file:../../../src/bindings/js/node/"
|
||||
"openvino-node": "file:../../../src/bindings/js/node/"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ."
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# OpenVINO™ JavaScript API
|
||||
|
||||
- `./node` - openvinojs-node NPM package with Node.js bindings
|
||||
- `./node` - openvino-node NPM package with Node.js bindings
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Javascript bindings
|
||||
|
||||
- `./docs` - documentation
|
||||
- `./node` - openvinojs-node NPM package with Node.js bindings
|
||||
- `./node` - openvino-node NPM package with Node.js bindings
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
build
|
||||
bin
|
||||
include
|
||||
lib
|
||||
src
|
||||
|
|
|
|||
|
|
@ -11,17 +11,33 @@
|
|||
|
||||
- Make sure that all submodules are updated `git submodule update --init --recursive`
|
||||
- Create build dir `mkdir build && cd build`
|
||||
- To get binaries for openvinojs-node package run:
|
||||
`cmake -DCPACK_GENERATOR=NPM -DENABLE_SYSTEM_TBB=OFF -UTBB* -DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin ..`
|
||||
`make --jobs=$(nproc --all) install`
|
||||
- Configure binaries building:
|
||||
```bash
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_FASTER_BUILD=ON \
|
||||
-DCPACK_GENERATOR=NPM \
|
||||
-DENABLE_SYSTEM_TBB=OFF -UTBB* \
|
||||
-DENABLE_TESTS=OFF \
|
||||
-DENABLE_SAMPLES=OFF \
|
||||
-DENABLE_WHEEL=OFF \
|
||||
-DENABLE_PYTHON=OFF \
|
||||
-DENABLE_INTEL_GPU=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin \
|
||||
..
|
||||
```
|
||||
- Build bindings:
|
||||
`cmake --build . --config Release --verbose -j4`
|
||||
- Install binaries for openvino-node package:
|
||||
`cmake --install .`
|
||||
- Go to npm package folder `cd ../src/bindings/js/node`
|
||||
- Now you can install dependencies packages and transpile ts to js code. Run `npm install`
|
||||
- Run tests `npm run test` to make sure that **openvinojs-node** built successfully
|
||||
- Run tests `npm run test` to make sure that **openvino-node** built successfully
|
||||
|
||||
## Usage
|
||||
|
||||
- Add `openvinojs-node` package in your project, specify in **package.json**: `"openvinojs-node": "file:*path-to-current-directory*"`
|
||||
- Require by: `const ov = require('openvinojs-node');`
|
||||
- Add `openvino-node` package in your project, specify in **package.json**: `"openvino-node": "file:*path-to-current-directory*"`
|
||||
- Require by: `const ov = require('openvino-node');`
|
||||
|
||||
## Samples
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue