Skip to content

Commit 4a6b8cc

Browse files
committed
[demo] Fix token-classification (Closes huggingface#116)
1 parent 8d8f511 commit 4a6b8cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/demo-site/src/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async function token_classification(data) {
292292
let currentChunk = { type: '', text: [] };
293293

294294
for (let i = 0; i < outputs.length; i++) {
295-
let word = pipeline.tokenizer.model.tokens_to_ids[outputs[i].word];
295+
let word = pipeline.tokenizer.model.tokens_to_ids.get(outputs[i].word);
296296
let entity = outputs[i].entity;
297297

298298
if (entity.startsWith('B-')) { // beginning of a new chunk

0 commit comments

Comments
 (0)