Fix misplaced token in ner task
Browse files
app.py
CHANGED
@@ -222,6 +222,7 @@ def ner_inference(model, tokenizer, text, device):
|
|
222 |
# Decode the input ids to tokens
|
223 |
tokens = tokenizer.convert_ids_to_tokens(input_ids[0], skip_special_tokens=True)
|
224 |
|
|
|
225 |
# Combine tokens with their NER labels
|
226 |
ner_tags = list(zip(tokens, labels))
|
227 |
|
|
|
222 |
# Decode the input ids to tokens
|
223 |
tokens = tokenizer.convert_ids_to_tokens(input_ids[0], skip_special_tokens=True)
|
224 |
|
225 |
+
labels = labels[1:-1]
|
226 |
# Combine tokens with their NER labels
|
227 |
ner_tags = list(zip(tokens, labels))
|
228 |
|