lfcc commited on
Commit
65ce669
1 Parent(s): fbe25c6
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -9,7 +9,7 @@ import json
9
 
10
  st.set_page_config(layout="wide")
11
 
12
- model = AutoModelForTokenClassification.from_pretrained("models/lusa",use_safetensors=True)
13
 
14
  tokenizer = AutoTokenizer.from_pretrained("models/lusa", model_max_length=512)
15
  tagger = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy='first') #aggregation_strategy='max'
@@ -61,7 +61,8 @@ def annotateTriggers(line):
61
  token_labels.append((token, 'B', current_entity))
62
  elif label.startswith('I-'):
63
  if current_entity == '':
64
- raise ValueError(f"Invalid label sequence: {predicted_token_class}")
 
65
  token_labels[-1] = (token_labels[-1][0] + f" {token}", 'I', current_entity)
66
  else:
67
  raise ValueError(f"Invalid label: {label}")
 
9
 
10
  st.set_page_config(layout="wide")
11
 
12
+ model = AutoModelForTokenClassification.from_pretrained("models/lusa", use_safetensors=True)
13
 
14
  tokenizer = AutoTokenizer.from_pretrained("models/lusa", model_max_length=512)
15
  tagger = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy='first') #aggregation_strategy='max'
 
61
  token_labels.append((token, 'B', current_entity))
62
  elif label.startswith('I-'):
63
  if current_entity == '':
64
+ #raise ValueError(f"Invalid label sequence: {predicted_token_class}")
65
+ continue
66
  token_labels[-1] = (token_labels[-1][0] + f" {token}", 'I', current_entity)
67
  else:
68
  raise ValueError(f"Invalid label: {label}")