GotThatData commited on
Commit
84444f7
·
1 Parent(s): ed49592

Fix response parsing for API format

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -82,7 +82,7 @@ def run_verification(num_variables: int, num_trials: int, progress=gr.Progress()
82
 
83
  data = response.json()
84
 
85
- if data.get("status") != "success":
86
  return format_error(data.get("error", "Unknown error"))
87
 
88
  progress(0.8, desc="Processing results...")
@@ -92,7 +92,16 @@ def run_verification(num_variables: int, num_trials: int, progress=gr.Progress()
92
  # Calculate metrics
93
  mean_satisfaction = results.get("mean_satisfaction", 0)
94
  std_satisfaction = results.get("std_satisfaction", 0)
95
- quality_tier = results.get("quality_tier", "UNKNOWN")
 
 
 
 
 
 
 
 
 
96
 
97
  # Energy calculation
98
  energy_joules = HARDWARE_INFO["typical_power"] * elapsed_time
 
82
 
83
  data = response.json()
84
 
85
+ if not data.get("success"):
86
  return format_error(data.get("error", "Unknown error"))
87
 
88
  progress(0.8, desc="Processing results...")
 
92
  # Calculate metrics
93
  mean_satisfaction = results.get("mean_satisfaction", 0)
94
  std_satisfaction = results.get("std_satisfaction", 0)
95
+
96
+ # Derive quality tier from satisfaction percentage
97
+ if mean_satisfaction >= 95:
98
+ quality_tier = "EXCELLENT"
99
+ elif mean_satisfaction >= 85:
100
+ quality_tier = "GOOD"
101
+ elif mean_satisfaction >= 70:
102
+ quality_tier = "ACCEPTABLE"
103
+ else:
104
+ quality_tier = "LOW"
105
 
106
  # Energy calculation
107
  energy_joules = HARDWARE_INFO["typical_power"] * elapsed_time