From 4eba4f292f739eb9e49fee2fab05b58e63381ea1 Mon Sep 17 00:00:00 2001 From: kevinanielsen Date: Tue, 21 Nov 2023 11:56:50 +0100 Subject: [PATCH] docs: update readme to reflect new feature --- README.md | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9a3baae..4783b10 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # tfjs-image-node + A simple image classifier using tfjs, that can run in Node.js ### Install + ```bash npm i tfjs-image-node # or @@ -9,32 +11,35 @@ 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 + @@ -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. - - - - -
- METADATA - - JSON including labels: string[] - - The metadata for your AI model, including the labels for the model's predictions. -
- - - - -