Spaces:
Sleeping
Sleeping
Update utils/target_classifier.py
Browse files- utils/target_classifier.py +11 -4
utils/target_classifier.py
CHANGED
|
@@ -103,17 +103,24 @@ def target_classification(haystack_doc:pd.DataFrame,
|
|
| 103 |
logging.info("Working on target/action identification")
|
| 104 |
|
| 105 |
haystack_doc['Target Label'] = 'NA'
|
| 106 |
-
|
|
|
|
|
|
|
| 107 |
if not classifier_model:
|
| 108 |
|
| 109 |
-
|
| 110 |
|
|
|
|
|
|
|
|
|
|
| 111 |
# Get predictions
|
| 112 |
predictions = classifier_model(list(haystack_doc.text))
|
| 113 |
-
|
|
|
|
| 114 |
# Get labels for predictions
|
| 115 |
pred_labels = get_target_labels(predictions)
|
| 116 |
-
|
|
|
|
| 117 |
# Save labels
|
| 118 |
haystack_doc['Target Label'] = pred_labels
|
| 119 |
|
|
|
|
| 103 |
logging.info("Working on target/action identification")
|
| 104 |
|
| 105 |
haystack_doc['Target Label'] = 'NA'
|
| 106 |
+
st.write("haystack_doc")
|
| 107 |
+
st.write(haystack_doc)
|
| 108 |
+
|
| 109 |
if not classifier_model:
|
| 110 |
|
| 111 |
+
st.write("No classifier_model")
|
| 112 |
|
| 113 |
+
classifier_model = st.session_state['target_classifier']
|
| 114 |
+
st.write("classifier model defined")
|
| 115 |
+
|
| 116 |
# Get predictions
|
| 117 |
predictions = classifier_model(list(haystack_doc.text))
|
| 118 |
+
st.write("predictions made")
|
| 119 |
+
st.predictions.head(20)
|
| 120 |
# Get labels for predictions
|
| 121 |
pred_labels = get_target_labels(predictions)
|
| 122 |
+
st.write("pred_labels")
|
| 123 |
+
st.write(pred_labels)
|
| 124 |
# Save labels
|
| 125 |
haystack_doc['Target Label'] = pred_labels
|
| 126 |
|