Upload app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,9 @@ def generate_beam_html(index, all_beams_data, dark_mode):
|
|
| 27 |
normal_color = "white" if dark_mode else "black"
|
| 28 |
|
| 29 |
for token, score in zip(beam_tokens, beam_scores):
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
if score < 0.6:
|
| 32 |
color = "red"
|
| 33 |
bg_color = "#441111" if dark_mode else "#ffe6e6"
|
|
|
|
| 27 |
normal_color = "white" if dark_mode else "black"
|
| 28 |
|
| 29 |
for token, score in zip(beam_tokens, beam_scores):
|
| 30 |
+
# Comprehensive replacement of SentencePiece space (U+2581),
|
| 31 |
+
# literal underscores (U+005F), and non-breaking spaces (U+00A0).
|
| 32 |
+
display_token = token.replace('▁', ' ').replace('_', ' ').replace(' ', ' ')
|
| 33 |
if score < 0.6:
|
| 34 |
color = "red"
|
| 35 |
bg_color = "#441111" if dark_mode else "#ffe6e6"
|