Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,7 @@ def predict_text(params):
|
|
| 36 |
return {"error": "Missing required parameters: 'texts'"}
|
| 37 |
|
| 38 |
solutions = []
|
| 39 |
-
confidence_threshold = 0.
|
| 40 |
|
| 41 |
for text, file_id in zip(texts, file_ids):
|
| 42 |
encoding = bert_tokenizer.encode_plus(
|
|
@@ -60,7 +60,7 @@ def predict_text(params):
|
|
| 60 |
|
| 61 |
# Get the confidence score for the predicted label
|
| 62 |
confidence = softmax_scores[pred_label]
|
| 63 |
-
|
| 64 |
# If confidence is below the threshold, set answer to None
|
| 65 |
if confidence < confidence_threshold:
|
| 66 |
pred_label = 7 # Set to 'None' class
|
|
|
|
| 36 |
return {"error": "Missing required parameters: 'texts'"}
|
| 37 |
|
| 38 |
solutions = []
|
| 39 |
+
confidence_threshold = 0.85 # Define your confidence threshold
|
| 40 |
|
| 41 |
for text, file_id in zip(texts, file_ids):
|
| 42 |
encoding = bert_tokenizer.encode_plus(
|
|
|
|
| 60 |
|
| 61 |
# Get the confidence score for the predicted label
|
| 62 |
confidence = softmax_scores[pred_label]
|
| 63 |
+
print(confidence)
|
| 64 |
# If confidence is below the threshold, set answer to None
|
| 65 |
if confidence < confidence_threshold:
|
| 66 |
pred_label = 7 # Set to 'None' class
|