From 59c2f8163f4235744e6eaf6fea629c3a800849e5 Mon Sep 17 00:00:00 2001 From: jcollopy-tulane Date: Mon, 29 Apr 2024 02:55:05 -0500 Subject: [PATCH] f --- nlp/cli.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nlp/cli.py b/nlp/cli.py index 18d41a6..9de5675 100644 --- a/nlp/cli.py +++ b/nlp/cli.py @@ -174,9 +174,11 @@ def train_cnn(): except Exception as e: print(f"Error loading model or tokenizer: {e}") - X_train = train_df["Comment_Adj"].apply(lambda x: cnn_process(x, tokenizer, maxlen=100)) - X_val = val_df["Comment_Adj"].apply(lambda x: cnn_process(x, tokenizer, maxlen=100)) - + def process_with_tokenizer(text): + return cnn_process(text, tokenizer, maxlen=100) + + X_train = train_df["Comment_Adj"].apply(process_with_tokenizer) + X_val = val_df["Comment_Adj"].apply(process_with_tokenizer) predictions = cnn.predict(X_val) predictions = (predictions > 0.5).astype(int)