fasttext.js
fasttext.js copied to clipboard
Using in the browser with WASM
Are the uploaded binaries for WASM usable in the browser? I tried following https://fasttext.cc/docs/en/webassembly-module.html#build-a-webpage-that-uses-fasttext to load fasttext using the provided binaries but I got import errors:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head>
<body>
<script type="module">
import {FastText, addOnPostRun} from "./fasttext.js";
addOnPostRun(() => {
let ft = new FastText();
console.log(ft);
});
</script>
</body>
</html>
Uncaught SyntaxError: import not found: addOnPostRun in the browser.
@Uzay-G correct I will provide a modified WASM module for browser based inference.
Was actually looking for something to do language identification client side, bit sad this does work even though it seems it could.