Spaces:
Sleeping
Sleeping
clarify the code structure (and fix a syntax error)
Browse files
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 +=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|