Frenchizer commited on
Commit
f9352fb
·
verified ·
1 Parent(s): 0c0c4a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 = [(label, score) for label, score 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", 1.0)] # Assign a default score of 1.0 for "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