satyaki-mitra commited on
Commit
154e93c
·
1 Parent(s): 63cf709

UI Gauge fixed

Browse files
Files changed (2) hide show
  1. detector/ensemble.py +4 -4
  2. ui/static/index.html +12 -5
detector/ensemble.py CHANGED
@@ -74,13 +74,13 @@ class EnsembleClassifier:
74
 
75
  Arguments:
76
  ----------
77
- primary_method : Primary aggregation method : "confidence_calibrated", "domain_adaptive", "consensus_based", "ml_ensemble"
78
 
79
- fallback_method : Fallback method if primary fails : "domain_weighted", "confidence_weighted", "simple_average"
80
 
81
- use_ml_ensemble : Use RandomForest for final aggregation (requires training)
82
 
83
- min_metrics_required: Minimum number of valid metrics required
84
  """
85
  self.primary_method = primary_method
86
  self.fallback_method = fallback_method
 
74
 
75
  Arguments:
76
  ----------
77
+ primary_method : Primary aggregation method : "confidence_calibrated", "domain_adaptive", "consensus_based", "ml_ensemble"
78
 
79
+ fallback_method : Fallback method if primary fails : "domain_weighted", "confidence_weighted", "simple_average"
80
 
81
+ use_ml_ensemble : Use RandomForest for final aggregation (requires training)
82
 
83
+ min_metrics_required : Minimum number of valid metrics required
84
  """
85
  self.primary_method = primary_method
86
  self.fallback_method = fallback_method
ui/static/index.html CHANGED
@@ -1891,23 +1891,30 @@ function generateAttributionReasoningHTML(reasoning) {
1891
 
1892
  // Helper function to create single-progress gauge section
1893
  function createGaugeSection(aiProbability, humanProbability, mixedProbability, gaugeColor, gaugeDegree) {
 
 
 
 
 
1894
  // Determine which probability is highest
1895
  let maxValue, maxColor, maxLabel;
1896
 
1897
- if (aiProbability >= humanProbability && aiProbability >= mixedProbability) {
1898
- maxValue = aiProbability;
1899
  maxColor = 'var(--danger)';
1900
  maxLabel = 'AI Probability';
1901
- } else if (humanProbability >= aiProbability && humanProbability >= mixedProbability) {
1902
- maxValue = humanProbability;
1903
  maxColor = 'var(--success)';
1904
  maxLabel = 'Human Probability';
1905
  } else {
1906
- maxValue = mixedProbability;
1907
  maxColor = 'var(--primary)';
1908
  maxLabel = 'Mixed Probability';
1909
  }
1910
 
 
 
1911
  // Calculate the degree for the progress (maxValue% of 360 degrees)
1912
  const progressDegree = (maxValue / 100) * 360;
1913
 
 
1891
 
1892
  // Helper function to create single-progress gauge section
1893
  function createGaugeSection(aiProbability, humanProbability, mixedProbability, gaugeColor, gaugeDegree) {
1894
+ // Ensure these are numbers
1895
+ const ai = parseFloat(aiProbability);
1896
+ const human = parseFloat(humanProbability);
1897
+ const mixed = parseFloat(mixedProbability);
1898
+
1899
  // Determine which probability is highest
1900
  let maxValue, maxColor, maxLabel;
1901
 
1902
+ if (ai >= human && ai >= mixed) {
1903
+ maxValue = ai;
1904
  maxColor = 'var(--danger)';
1905
  maxLabel = 'AI Probability';
1906
+ } else if (human >= ai && human >= mixed) {
1907
+ maxValue = human;
1908
  maxColor = 'var(--success)';
1909
  maxLabel = 'Human Probability';
1910
  } else {
1911
+ maxValue = mixed;
1912
  maxColor = 'var(--primary)';
1913
  maxLabel = 'Mixed Probability';
1914
  }
1915
 
1916
+ console.log('Selected:', { maxValue, maxLabel });
1917
+
1918
  // Calculate the degree for the progress (maxValue% of 360 degrees)
1919
  const progressDegree = (maxValue / 100) * 360;
1920