DavidCombei commited on
Commit
cebb599
·
verified ·
1 Parent(s): 87c5f6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -64,6 +64,10 @@ def process_audio(input_data, segment_duration=10):
64
  confidence_percentage = ((decision_score_scaled - eer_threshold) / (1 - eer_threshold)) * 100
65
  else:
66
  confidence_percentage = ((eer_threshold - decision_score_scaled) / eer_threshold) * 100
 
 
 
 
67
  segment_predictions.append(pred)
68
  line = f"Segment {idx + 1}: {'Real' if pred == 1 else 'Fake'} (Confidence: {round(confidence_percentage, 2)}%)"
69
  output_lines.append(line)
 
64
  confidence_percentage = ((decision_score_scaled - eer_threshold) / (1 - eer_threshold)) * 100
65
  else:
66
  confidence_percentage = ((eer_threshold - decision_score_scaled) / eer_threshold) * 100
67
+
68
+ #with the above logic I got some scores out of the range [0-100] for the confidence score on some unseen data due to the logic, brute fix :)
69
+ confidence_percentage = max(0, min(confidence_percentage, 100))
70
+
71
  segment_predictions.append(pred)
72
  line = f"Segment {idx + 1}: {'Real' if pred == 1 else 'Fake'} (Confidence: {round(confidence_percentage, 2)}%)"
73
  output_lines.append(line)