Spaces:
Runtime error
Runtime error
Increase model threshold and conservativeness
Browse files- functions/model_infer.py +2 -1
functions/model_infer.py
CHANGED
@@ -37,5 +37,6 @@ def preprocess(sentences):
|
|
37 |
def predict_from_document(sentences):
|
38 |
preprop = preprocess(sentences)
|
39 |
prediction = model.predict(preprop)
|
40 |
-
|
|
|
41 |
return output, prediction.flatten()[: len(sentences)]
|
|
|
37 |
def predict_from_document(sentences):
|
38 |
preprop = preprocess(sentences)
|
39 |
prediction = model.predict(preprop)
|
40 |
+
# Set the prediction threshold to 0.8
|
41 |
+
output = (prediction.flatten()[: len(sentences)] >= 0.8).astype(int)
|
42 |
return output, prediction.flatten()[: len(sentences)]
|