kcarnold commited on
Commit
a321d69
·
verified ·
1 Parent(s): 92076bd

Simplify highlighting

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -91,8 +91,8 @@ for span in spans:
91
 
92
  html_out = ''
93
  for span in spans:
94
- b = int(256 * span["token_loss"] / highest_loss)
95
- html_out += f'<span style="color: rgba(128, 128, {b:d})" title="{html.escape(span["most_likely_token"])}">{html.escape(span["token"])}</span>'
96
  html_out = f"<p style=\"background: white;\">{html_out}</p>"
97
 
98
  st.subheader("Rewritten document")
 
91
 
92
  html_out = ''
93
  for span in spans:
94
+ is_different = span['token'] != span['most_likely_token']
95
+ html_out += f'<span style="color: {'red' if is_different else 'black'}" title="{html.escape(span["most_likely_token"])}">{html.escape(span["token"])}</span>'
96
  html_out = f"<p style=\"background: white;\">{html_out}</p>"
97
 
98
  st.subheader("Rewritten document")