Update utils/target_classifier.py
Browse files
utils/target_classifier.py
CHANGED
|
@@ -27,7 +27,7 @@ def get_target_labels(preds):
|
|
| 27 |
predictions_names=[]
|
| 28 |
|
| 29 |
# loop through each prediction
|
| 30 |
-
for ele in
|
| 31 |
|
| 32 |
# see if there is a value 1 and retrieve index
|
| 33 |
try:
|
|
@@ -105,18 +105,15 @@ def target_classification(haystack_doc:pd.DataFrame,
|
|
| 105 |
logging.info("Working on target/action identification")
|
| 106 |
|
| 107 |
haystack_doc['Target Label'] = 'NA'
|
| 108 |
-
|
| 109 |
-
## TEST DELETE ###
|
| 110 |
-
if classifier_model:
|
| 111 |
-
st.write("This is the classifier model")
|
| 112 |
-
st.write(classifier_model)
|
| 113 |
-
|
| 114 |
if not classifier_model:
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
| 117 |
|
| 118 |
# Get predictions
|
| 119 |
-
predictions =
|
| 120 |
st.write('predictions')
|
| 121 |
st.write(predictions[:10])
|
| 122 |
|
|
|
|
| 27 |
predictions_names=[]
|
| 28 |
|
| 29 |
# loop through each prediction
|
| 30 |
+
for ele in preds:
|
| 31 |
|
| 32 |
# see if there is a value 1 and retrieve index
|
| 33 |
try:
|
|
|
|
| 105 |
logging.info("Working on target/action identification")
|
| 106 |
|
| 107 |
haystack_doc['Target Label'] = 'NA'
|
| 108 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
if not classifier_model:
|
| 110 |
|
| 111 |
+
classifier_model = st.session_state['target_classifier']
|
| 112 |
+
st.write("utils - classifier model")
|
| 113 |
+
st.write(classifier_model)
|
| 114 |
|
| 115 |
# Get predictions
|
| 116 |
+
predictions = classifier_model(list(haystack_doc.text))
|
| 117 |
st.write('predictions')
|
| 118 |
st.write(predictions[:10])
|
| 119 |
|