This commit is contained in:
Alex Garcia 2024-07-31 12:55:35 -07:00
parent dd972f6ffe
commit 47e61aa187

View file

@ -9,11 +9,6 @@
const sqlite3 = await init();
const extractor = await pipeline(
"feature-extraction",
"Xenova/all-MiniLM-L6-v2",
);
const dbContents = await fetch("articles.db").then((r) => r.arrayBuffer());
const db = new sqlite3.oo1.DB();
const p = sqlite3.wasm.allocFromTypedArray(dbContents);
@ -27,6 +22,13 @@
);
db.checkRc(rc);
const extractor = await pipeline(
"feature-extraction",
"Xenova/all-MiniLM-L6-v2",
);
const query = "sports";
const queryEmbedding = await extractor([query], {
pooling: "mean",