Spaces:
Running
Running
Deploy v0.2.0 from gabrielkpo/alias
Browse files- app.js +10 -1
- index.html +1 -1
app.js
CHANGED
|
@@ -11,6 +11,10 @@ import {
|
|
| 11 |
import { TAGS, detect, mask, restore } from "./alias.js";
|
| 12 |
|
| 13 |
const MODEL = "Gabrielkph/alias-mmbert-small";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
// What the first visit downloads: the ONNX model (563 MB) and the tokenizer (34 MB).
|
| 15 |
const EXPECTED_BYTES = 597e6;
|
| 16 |
|
|
@@ -89,8 +93,12 @@ async function load() {
|
|
| 89 |
);
|
| 90 |
};
|
| 91 |
setStatus("Loading the model…");
|
| 92 |
-
const tokenizer = await AutoTokenizer.from_pretrained(MODEL, {
|
|
|
|
|
|
|
|
|
|
| 93 |
const model = await AutoModelForTokenClassification.from_pretrained(MODEL, {
|
|
|
|
| 94 |
dtype: "fp32", // int8 destroys this model's precision (docs/TRAINING.md)
|
| 95 |
device: "wasm",
|
| 96 |
progress_callback: progress,
|
|
@@ -290,6 +298,7 @@ function updateCount() {
|
|
| 290 |
$("count").textContent = n ? `${n.toLocaleString()} characters` : "";
|
| 291 |
}
|
| 292 |
|
|
|
|
| 293 |
$("mask").addEventListener("click", maskText);
|
| 294 |
$("example").addEventListener("click", () => {
|
| 295 |
$("input").value = EXAMPLE;
|
|
|
|
| 11 |
import { TAGS, detect, mask, restore } from "./alias.js";
|
| 12 |
|
| 13 |
const MODEL = "Gabrielkph/alias-mmbert-small";
|
| 14 |
+
// The model version the demo was tested with: a tag on the model repository, so a later upload
|
| 15 |
+
// of new weights cannot change the demo without a new release of it.
|
| 16 |
+
const MODEL_REVISION = "v1.0";
|
| 17 |
+
const VERSION = "0.2.0"; // x-release-please-version
|
| 18 |
// What the first visit downloads: the ONNX model (563 MB) and the tokenizer (34 MB).
|
| 19 |
const EXPECTED_BYTES = 597e6;
|
| 20 |
|
|
|
|
| 93 |
);
|
| 94 |
};
|
| 95 |
setStatus("Loading the model…");
|
| 96 |
+
const tokenizer = await AutoTokenizer.from_pretrained(MODEL, {
|
| 97 |
+
revision: MODEL_REVISION,
|
| 98 |
+
progress_callback: progress,
|
| 99 |
+
});
|
| 100 |
const model = await AutoModelForTokenClassification.from_pretrained(MODEL, {
|
| 101 |
+
revision: MODEL_REVISION,
|
| 102 |
dtype: "fp32", // int8 destroys this model's precision (docs/TRAINING.md)
|
| 103 |
device: "wasm",
|
| 104 |
progress_callback: progress,
|
|
|
|
| 298 |
$("count").textContent = n ? `${n.toLocaleString()} characters` : "";
|
| 299 |
}
|
| 300 |
|
| 301 |
+
$("version").textContent = `Alias v${VERSION}, model ${MODEL_REVISION}.`;
|
| 302 |
$("mask").addEventListener("click", maskText);
|
| 303 |
$("example").addEventListener("click", () => {
|
| 304 |
$("input").value = EXAMPLE;
|
index.html
CHANGED
|
@@ -78,6 +78,6 @@
|
|
| 78 |
<a href="https://github.com/gabrielkpo/alias" target="_blank" rel="noopener">code, results and limits</a>. Model:
|
| 79 |
<a href="https://huggingface.co/Gabrielkph/alias-mmbert-small" target="_blank" rel="noopener">mmBERT-small fine-tuned</a>,
|
| 80 |
plus checksum and keyword rules. No detector is perfect: read the masked text before sending
|
| 81 |
-
it.</footer>
|
| 82 |
</body>
|
| 83 |
</html>
|
|
|
|
| 78 |
<a href="https://github.com/gabrielkpo/alias" target="_blank" rel="noopener">code, results and limits</a>. Model:
|
| 79 |
<a href="https://huggingface.co/Gabrielkph/alias-mmbert-small" target="_blank" rel="noopener">mmBERT-small fine-tuned</a>,
|
| 80 |
plus checksum and keyword rules. No detector is perfect: read the masked text before sending
|
| 81 |
+
it. <span id="version"></span></footer>
|
| 82 |
</body>
|
| 83 |
</html>
|