Julien Matuszak commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,7 +77,7 @@ def detect_context(input_text, threshold=0.03):
|
|
| 77 |
label_probabilities = list(zip(labels, probabilities))
|
| 78 |
|
| 79 |
# Filter contexts with confidence >= threshold
|
| 80 |
-
high_confidence_contexts = [
|
| 81 |
|
| 82 |
# If no contexts meet the threshold, default to "general"
|
| 83 |
if not high_confidence_contexts:
|
|
|
|
| 77 |
label_probabilities = list(zip(labels, probabilities))
|
| 78 |
|
| 79 |
# Filter contexts with confidence >= threshold
|
| 80 |
+
high_confidence_contexts = [(label, score) for label, scores in label_probabilities if score >= threshold]
|
| 81 |
|
| 82 |
# If no contexts meet the threshold, default to "general"
|
| 83 |
if not high_confidence_contexts:
|