Spaces:
Sleeping
Sleeping
added colors
Browse files
app.py
CHANGED
@@ -32,10 +32,17 @@ if __name__ == "__main__":
|
|
32 |
]
|
33 |
|
34 |
label_to_color = {
|
35 |
-
"p >= 80%": "
|
36 |
-
"p >=
|
37 |
-
"p >=
|
38 |
-
"p >=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
def get_tokens_and_labels(prompt):
|
@@ -48,7 +55,7 @@ if __name__ == "__main__":
|
|
48 |
)
|
49 |
# Important: don't forget to set `normalize_logits=True` to obtain normalized probabilities (i.e. sum(p) = 1)
|
50 |
transition_scores = model.compute_transition_scores(outputs.sequences, outputs.scores, normalize_logits=True)
|
51 |
-
transition_proba = np.exp(transition_scores
|
52 |
# We only have scores for the generated tokens, so pop out the prompt tokens
|
53 |
input_length = 1 if model.config.is_encoder_decoder else inputs.input_ids.shape[1]
|
54 |
generated_ids = outputs.sequences[:, input_length:]
|
|
|
32 |
]
|
33 |
|
34 |
label_to_color = {
|
35 |
+
"p >= 80%": "#d91111",
|
36 |
+
"p >= 90%": "#d97211",
|
37 |
+
"p >= 80%": "#d99a11",
|
38 |
+
"p >= 70%": "#d9c111",
|
39 |
+
"p >= 60%": "#d5d911",
|
40 |
+
"p >= 50%": "#a0d911",
|
41 |
+
"p >= 40%": "#4dd911",
|
42 |
+
"p >= 30%": "#11d954",
|
43 |
+
"p >= 20%": "#11d9a0",
|
44 |
+
"p >= 10%": "#11d9d2",
|
45 |
+
"p >= 00%": "#11b4d9"
|
46 |
}
|
47 |
|
48 |
def get_tokens_and_labels(prompt):
|
|
|
55 |
)
|
56 |
# Important: don't forget to set `normalize_logits=True` to obtain normalized probabilities (i.e. sum(p) = 1)
|
57 |
transition_scores = model.compute_transition_scores(outputs.sequences, outputs.scores, normalize_logits=True)
|
58 |
+
transition_proba = np.exp(transition_scores)
|
59 |
# We only have scores for the generated tokens, so pop out the prompt tokens
|
60 |
input_length = 1 if model.config.is_encoder_decoder else inputs.input_ids.shape[1]
|
61 |
generated_ids = outputs.sequences[:, input_length:]
|