kcarnold commited on
Commit
3ff8b95
·
1 Parent(s): 6a6edd2

clarify the code structure (and fix a syntax error)

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -92,7 +92,11 @@ for span in spans:
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"]).replace('\n', ' ')}">{html.escape(span["token"]).replace('\n', '<br>')}</span>'
 
 
 
 
96
  html_out = f"<p style=\"background: white;\">{html_out}</p>"
97
 
98
  st.subheader("Rewritten document")
 
92
  html_out = ''
93
  for span in spans:
94
  is_different = span['token'] != span['most_likely_token']
95
+ html_out += '<span style="color: {color}" title="{title}">{orig_token}</span>'.format(
96
+ color="red" if is_different else "black",
97
+ title=html.escape(span["most_likely_token"]).replace('\n', ' '),
98
+ orig_token=html.escape(span["token"]).replace('\n', '<br>')
99
+ )
100
  html_out = f"<p style=\"background: white;\">{html_out}</p>"
101
 
102
  st.subheader("Rewritten document")