Spaces:
Running
Running
Jooha Yoo
commited on
Commit
·
af927dd
1
Parent(s):
a2477f5
changed color, removed the title attribute
Browse files
app.py
CHANGED
@@ -148,9 +148,8 @@ def highlights_component(spans, show_alternatives, min_loss):
|
|
148 |
show = span['token'] != span['most_likely_token'] and span['loss_ratio'] >= min_loss
|
149 |
show_alternative = show and show_alternatives
|
150 |
hover = f'<span class="alternative">{span["most_likely_token"]}</span>'
|
151 |
-
html_out += '<span style="color: {color}"
|
152 |
color="grey" if show else "black",
|
153 |
-
title=html.escape(span["most_likely_token"]).replace('\n', ' ') if show_alternative else '',
|
154 |
orig_token=html.escape(span["token"]).replace('\n', '<br>'),
|
155 |
hover=hover if show_alternative else ''
|
156 |
)
|
@@ -173,7 +172,7 @@ def highlights_component(spans, show_alternatives, min_loss):
|
|
173 |
left: 5px;
|
174 |
min-width: 6em;
|
175 |
line-height: 1;
|
176 |
-
color:
|
177 |
}}
|
178 |
</style>
|
179 |
<p class="highlights-container">{html_out}</p>
|
|
|
148 |
show = span['token'] != span['most_likely_token'] and span['loss_ratio'] >= min_loss
|
149 |
show_alternative = show and show_alternatives
|
150 |
hover = f'<span class="alternative">{span["most_likely_token"]}</span>'
|
151 |
+
html_out += '<span style="color: {color}" >{hover}{orig_token}</span>'.format(
|
152 |
color="grey" if show else "black",
|
|
|
153 |
orig_token=html.escape(span["token"]).replace('\n', '<br>'),
|
154 |
hover=hover if show_alternative else ''
|
155 |
)
|
|
|
172 |
left: 5px;
|
173 |
min-width: 6em;
|
174 |
line-height: 1;
|
175 |
+
color: blue;
|
176 |
}}
|
177 |
</style>
|
178 |
<p class="highlights-container">{html_out}</p>
|