Spaces:
Running
Running
kovacsvi
commited on
Commit
·
5f6b004
1
Parent(s):
90fa7ec
debug prints
Browse files
interfaces/cap_minor_media.py
CHANGED
@@ -95,15 +95,20 @@ def predict(text, major_model_id, minor_model_id, tokenizer_id, HF_TOKEN=None):
|
|
95 |
top_major_id = major_index_to_id[top_major_index]
|
96 |
|
97 |
# Default: show major topic predictions
|
|
|
98 |
filtered_probs = {
|
99 |
i: float(major_probs_np[i])
|
100 |
for i in np.argsort(major_probs_np)[::-1]
|
101 |
}
|
|
|
102 |
filtered_probs = normalize_probs(filtered_probs)
|
|
|
|
|
103 |
output_pred = {
|
104 |
f"[{major_index_to_id[k]}] {CAP_MEDIA_LABEL_NAMES[filtered_probs[k]]}": v
|
105 |
for k, v in sorted(filtered_probs.items(), key=lambda item: item[1], reverse=True)
|
106 |
}
|
|
|
107 |
|
108 |
# If eligible for minor prediction
|
109 |
if top_major_id in major_to_minor_map:
|
|
|
95 |
top_major_id = major_index_to_id[top_major_index]
|
96 |
|
97 |
# Default: show major topic predictions
|
98 |
+
print(major_probs_np) # debug
|
99 |
filtered_probs = {
|
100 |
i: float(major_probs_np[i])
|
101 |
for i in np.argsort(major_probs_np)[::-1]
|
102 |
}
|
103 |
+
print(filtered_probs) # debug
|
104 |
filtered_probs = normalize_probs(filtered_probs)
|
105 |
+
print(filtered_probs) # debug
|
106 |
+
|
107 |
output_pred = {
|
108 |
f"[{major_index_to_id[k]}] {CAP_MEDIA_LABEL_NAMES[filtered_probs[k]]}": v
|
109 |
for k, v in sorted(filtered_probs.items(), key=lambda item: item[1], reverse=True)
|
110 |
}
|
111 |
+
print(output_pred) # debug
|
112 |
|
113 |
# If eligible for minor prediction
|
114 |
if top_major_id in major_to_minor_map:
|