asdc commited on
Commit
65003ad
·
verified ·
1 Parent(s): 6c2c9be

Upload streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -2
src/streamlit_app.py CHANGED
@@ -80,8 +80,9 @@ def ner_with_robertime(text: str) -> List[Tuple[str, str]]:
80
  def colorize_entities(ner_result: List[Tuple[str, str]]) -> str:
81
  html = ''
82
  for token, label in ner_result:
83
- color = LABEL_COLORS.get(label, '#eeeeee')
84
- if label != 'LABEL-0':
 
85
  html += f'<span style="background-color:{color};padding:2px 4px;border-radius:4px;margin:1px;">{token}</span> '
86
  else:
87
  html += f'{token} '
 
80
  def colorize_entities(ner_result: List[Tuple[str, str]]) -> str:
81
  html = ''
82
  for token, label in ner_result:
83
+ norm_label = label.replace('_', '-')
84
+ if norm_label != 'LABEL-0':
85
+ color = LABEL_COLORS.get(norm_label, '#eeeeee')
86
  html += f'<span style="background-color:{color};padding:2px 4px;border-radius:4px;margin:1px;">{token}</span> '
87
  else:
88
  html += f'{token} '