Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,11 +77,11 @@ 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:
|
84 |
-
high_confidence_contexts = [("general"
|
85 |
|
86 |
return high_confidence_contexts
|
87 |
|
|
|
77 |
label_probabilities = list(zip(labels, probabilities))
|
78 |
|
79 |
# Filter contexts with confidence >= threshold
|
80 |
+
high_confidence_contexts = [label in label_probabilities if score >= threshold]
|
81 |
|
82 |
# If no contexts meet the threshold, default to "general"
|
83 |
if not high_confidence_contexts:
|
84 |
+
high_confidence_contexts = [("general")]
|
85 |
|
86 |
return high_confidence_contexts
|
87 |
|