diff options
author | Radamés Ajna <radamajna@gmail.com> | 2023-09-15 22:34:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 07:34:13 +0200 |
commit | 04ca2b9ebd75b065641512d4254850e065699030 (patch) | |
tree | 7248dee1357db00e748027da7c6be40bbb8faae7 /candle-wasm-examples/segment-anything/samWorker.js | |
parent | 635012d770a75033081008a22044804d277fafa8 (diff) | |
download | candle-04ca2b9ebd75b065641512d4254850e065699030.tar.gz candle-04ca2b9ebd75b065641512d4254850e065699030.tar.bz2 candle-04ca2b9ebd75b065641512d4254850e065699030.zip |
Update README + SAM (#866)
* use serde-wasm-bindgen, faster serialization
* update readme with demos
Diffstat (limited to 'candle-wasm-examples/segment-anything/samWorker.js')
-rw-r--r-- | candle-wasm-examples/segment-anything/samWorker.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/candle-wasm-examples/segment-anything/samWorker.js b/candle-wasm-examples/segment-anything/samWorker.js index b90498de..c1a152ef 100644 --- a/candle-wasm-examples/segment-anything/samWorker.js +++ b/candle-wasm-examples/segment-anything/samWorker.js @@ -141,8 +141,7 @@ self.addEventListener("message", async (event) => { } self.postMessage({ status: "segmenting", message: "Segmenting" }); - const result = sam.mask_for_point(points.x, points.y); - const { mask, image } = JSON.parse(result); + const { mask, image } = sam.mask_for_point(points.x, points.y); const maskDataURL = await createImageCanvas(mask, image); // Send the segment back to the main thread as JSON self.postMessage({ |