Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -159,11 +159,11 @@ def generate_markdown_table(scores, sequence_prob, top_k=4, chosen_tokens=None):
|
|
159 |
</tr>"""
|
160 |
for token_idx in np.array(np.argsort(scores)[-top_k:])[::-1]:
|
161 |
token = tokenizer.decode([token_idx])
|
162 |
-
|
163 |
if chosen_tokens and token in chosen_tokens:
|
164 |
-
|
165 |
markdown_table += f"""
|
166 |
-
<tr
|
167 |
<td>{token}</td>
|
168 |
<td>{scores[token_idx]:.4f}</td>
|
169 |
<td>{scores[token_idx] + sequence_prob:.4f}</td>
|
|
|
159 |
</tr>"""
|
160 |
for token_idx in np.array(np.argsort(scores)[-top_k:])[::-1]:
|
161 |
token = tokenizer.decode([token_idx])
|
162 |
+
item_class = ""
|
163 |
if chosen_tokens and token in chosen_tokens:
|
164 |
+
item_class = "chosen"
|
165 |
markdown_table += f"""
|
166 |
+
<tr class={item_class}>
|
167 |
<td>{token}</td>
|
168 |
<td>{scores[token_idx]:.4f}</td>
|
169 |
<td>{scores[token_idx] + sequence_prob:.4f}</td>
|