Skip to content

Commit

Permalink
docs: update readme to reflect new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinanielsen committed Nov 21, 2023
1 parent 05cdcd7 commit 4eba4f2
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
# tfjs-image-node

A simple image classifier using tfjs, that can run in Node.js

### Install

```bash
npm i tfjs-image-node
# or
yarn add tfjs-image-node
# or
bun add tfjs-image-node
```

### Import

```typescript
const classifyImage = require("tfjs-image-node");
// or
import { classifyImage } from "tfjs-image-node";
```


## Example

```typescript
const classifyImage = require("tfjs-image-node");

const metadata = require("./metadata.json");
const model = "https://teachablemachine.withgoogle.com/models/jAIOHvmge";
const image = "https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jpeg";
const image =
"https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jpeg";

(async () => {
const prediction = await classifyImage(model, image, metadata);
const prediction = await classifyImage(model, image);
console.log(prediction[0]);
})()
})();

// expected output:
// { label: 'Hand', probability: 0.9999574422836304 }
```

## Parameters

<table>
<thead>
<tr>
Expand Down Expand Up @@ -66,21 +71,5 @@ const image = "https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jp
The file path or URL to the image you want classified.
</td>
</tr>
<tr>
<td>
METADATA
</td>
<td>
JSON including labels: string[]
</td>
<td>
The metadata for your AI model, including the labels for the model's predictions.
</td>
</tr>
</tdata>
</table>





0 comments on commit 4eba4f2

Please sign in to comment.