Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -124,6 +124,22 @@ def inference():
|
|
| 124 |
return final_outputs, final_targets
|
| 125 |
|
| 126 |
prediction, targets = inference()
|
| 127 |
-
st.write("before argmax")
|
| 128 |
st.write(prediction)
|
| 129 |
st.write(targets)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
return final_outputs, final_targets
|
| 125 |
|
| 126 |
prediction, targets = inference()
|
|
|
|
| 127 |
st.write(prediction)
|
| 128 |
st.write(targets)
|
| 129 |
+
|
| 130 |
+
best_preds = []
|
| 131 |
+
best_labels = []
|
| 132 |
+
for example in prediction:
|
| 133 |
+
i = np.argmax(example)
|
| 134 |
+
best_prediction = example(i)
|
| 135 |
+
best_label = label_set(i)
|
| 136 |
+
best_preds.append(best_prediction)
|
| 137 |
+
best_labels.append(best_label)
|
| 138 |
+
|
| 139 |
+
st.write("result")
|
| 140 |
+
st.write(result)
|
| 141 |
+
|
| 142 |
+
display_table = tweets_raw[["comment_text"]]
|
| 143 |
+
display_table["Toxicity Classification"] = best_labels
|
| 144 |
+
display_table["Probability"] = best_preds
|
| 145 |
+
st.write(display_table)
|