Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/testdotai/classifier-client-node
Node.js client for test.ai classifier server
https://github.com/testdotai/classifier-client-node
Last synced: about 2 months ago
JSON representation
Node.js client for test.ai classifier server
- Host: GitHub
- URL: https://github.com/testdotai/classifier-client-node
- Owner: testdotai
- Created: 2019-12-19T00:53:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-09T04:41:04.000Z (over 2 years ago)
- Last Synced: 2024-09-15T22:40:47.638Z (4 months ago)
- Language: JavaScript
- Size: 1.48 MB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test.ai Classifier - Node.js + WebdriverIO Client
The code in this directory defines a client library for use with the gRPC-based [Test.ai classifier server](https://github.com/testdotai/appium-classifier-plugin).
## Installation & Setup
```
npm install test-ai-classifier-client
```## Usage
This client exposes as the default export a `ClassifierClient` class, which can be instantiated as follows:
```js
const ClassifierClient = require('test-ai-classifier-client');
const client = new ClassifierClient({host, port})
```(Where `host` and `port` refer to the address and port the server is running on).
The client exposes two instance methods:
1. `classifyElements` takes an object parameter with 4 keys:
1. `labelHint`: the label you wish to find matching elements with (see `lib/labels.js` in this repo).
2. `elementImages`: an object whose keys are ids, and whose values are `Buffer` objects containing raw binary data of PNG images.
3. `confidenceThreshold`: (optional) the confidence below which not to return matches (0.0 - 1.0)
4. `allowWeakerMatches`: (optional) whether or not to return a match for elements that *did* match the label, but for whom *another* label had a higher confidence.The return value of this method is an object whose keys are the same ids you sent in, and whose values are classification objects with the following keys:
1. `label`: the matching label
2. `confidence`: the confidence for the matched label
3. `confidenceForLabel`: the confidence for the label given in `labelHint`
2. `findElementsMatchingLabel` is a helper function for use with Selenium tests (for Appium use the Appium plugin as described in the main README for this repo). It takes an object parameter with 4 keys: all of the same keys as in `classifyElements` except for `elementImages` which is replaced by:
1. `driver`: the WebdriverIO driver object
The return value of this method is an array of WebdriverIO element objects that match.For a concrete example, see `test/rpc-e2e-specs.js`
## Development
Tests expect a running Classifier server on port 50051.