Skip to content

Commit 4eba4f2

Browse files
committed
docs: update readme to reflect new feature
1 parent 05cdcd7 commit 4eba4f2

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

README.md

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
# tfjs-image-node
2+
23
A simple image classifier using tfjs, that can run in Node.js
34

45
### Install
6+
57
```bash
68
npm i tfjs-image-node
79
# or
810
yarn add tfjs-image-node
911
# or
1012
bun add tfjs-image-node
1113
```
14+
1215
### Import
16+
1317
```typescript
1418
const classifyImage = require("tfjs-image-node");
1519
// or
1620
import { classifyImage } from "tfjs-image-node";
1721
```
1822

19-
2023
## Example
24+
2125
```typescript
2226
const classifyImage = require("tfjs-image-node");
2327

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

2832
(async () => {
29-
const prediction = await classifyImage(model, image, metadata);
33+
const prediction = await classifyImage(model, image);
3034
console.log(prediction[0]);
31-
})()
35+
})();
3236

3337
// expected output:
3438
// { label: 'Hand', probability: 0.9999574422836304 }
3539
```
3640

3741
## Parameters
42+
3843
<table>
3944
<thead>
4045
<tr>
@@ -66,21 +71,5 @@ const image = "https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jp
6671
The file path or URL to the image you want classified.
6772
</td>
6873
</tr>
69-
<tr>
70-
<td>
71-
METADATA
72-
</td>
73-
<td>
74-
JSON including labels: string[]
75-
</td>
76-
<td>
77-
The metadata for your AI model, including the labels for the model's predictions.
78-
</td>
79-
</tr>
8074
</tdata>
8175
</table>
82-
83-
84-
85-
86-

0 commit comments

Comments
 (0)