Skip to content

Commit

Permalink
Fixing Probas
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollopy-tulane committed Apr 29, 2024
1 parent 0e7f998 commit bfd7964
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nlp/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ def index():
model = bnb
text = process_text(input_field)
text = bnb_vectorizer.transform([text])
pred = bnb.predict(text)
proba = bnb.predict_proba(text)[:, 1]
pred_labels = bnb.predict(text)
probas = bnb.predict_proba(text)
pred = pred_labels[0]
proba = probas[0, pred]
elif model_choice == 'lr':
model = lr
text = process_text(input_field)
text = lr_vectorizer.transform([text])
pred = lr.predict(text)
proba = lr.predict_proba(text)[:, 1]
pred_labels = lr.predict(text)
probas = lr.predict_proba(text)
pred = pred_labels[0]
proba = probas[0, pred]
elif model_choice == 'cnn':
# For CNN, assuming preprocessing is handled differently or is built-in
model = cnn
Expand Down

0 comments on commit bfd7964

Please sign in to comment.