Skip to content

Commit

Permalink
add model url params
Browse files Browse the repository at this point in the history
  • Loading branch information
do-me committed May 24, 2024
1 parent 67a8317 commit 568b6eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,22 @@ Lines: ${lineCount}`;
// initialize loading
// read url params and load from Hf or from remote
const urlParams = getUrlParameters();
const modelName = document.getElementById('model-name').value;
var modelName = document.getElementById('model-name').value;

// set some new experimental settings to allow for new use cases like synonym finder or "unique index" as described here: https://github.com/do-me/SemanticFinder/discussions/48

if (urlParams.has('model')) {
modelName = urlParams.get('model'); // overwrite default html model with url param
document.getElementById("model-name").value = modelName;
console.log("Model: " + modelName)
}

if (urlParams.has('quantized')) {
const urlQuantized = urlParams.get('quantized'); // overwrite default html model with url param
document.getElementById("quantized").checked = JSON.parse(urlQuantized);
console.log("Quantized: " + urlQuantized)
}

if (urlParams.has('firstOnly')) {
document.getElementById("firstOnly").checked = urlParams.get('firstOnly') === 'true';
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function embed(text, embedNewText=true) {
const roundDecimalsDown = (num) => parseFloat(num.toFixed(3));

embeddingsDict[text] = e0.data.map(roundDecimalsDown);
console.log(embeddingsDict)
//console.log(embeddingsDict)
return e0.data;

}
Expand Down

0 comments on commit 568b6eb

Please sign in to comment.