Skip to content

Commit

Permalink
fix: do not crash on empty request (no tensors)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpoy committed Dec 28, 2023
1 parent 77282f3 commit fd8560a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/predict.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const predict = async (sentences) => {
tensors.push(tensor);
}

if (!tensors.length) return [];

const tensor = tf.concat(tensors);

const resultTensors = classifierModel.predict(tensor);
Expand Down

0 comments on commit fd8560a

Please sign in to comment.