SamanthaStorm commited on
Commit
55fa759
·
verified ·
1 Parent(s): db2f223

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -168,25 +168,27 @@ class SimplifiedBoundaryAssistant:
168
  else:
169
  logger.info(f"No toxicity detected (pred: {toxicity_pred}, conf: {toxicity_conf})")
170
 
171
- # 3. Boundary Health Check (1=healthy, 0=unhealthy)
172
  logger.info("Running boundary health check...")
173
  boundary_pred, boundary_conf = self.predict_with_model(text, 'boundary')
174
  if boundary_pred is not None:
175
- if boundary_pred == 0 and boundary_conf > 0.7: # 0 = unhealthy
176
- logger.info(f"UNHEALTHY BOUNDARY DETECTED: confidence {boundary_conf:.3f}")
 
 
 
 
177
  analysis['is_healthy_boundary'] = False
178
  analysis['issues'].append({
179
  'type': 'unhealthy_boundary',
180
- 'name': 'Unhealthy Boundary Pattern',
181
  'confidence': boundary_conf,
182
  'severity': 2 if boundary_conf > 0.8 else 1
183
  })
184
  analysis['severity_score'] += 2 if boundary_conf > 0.8 else 1
185
- elif boundary_pred == 1: # 1 = healthy
186
- logger.info(f"HEALTHY BOUNDARY DETECTED: confidence {boundary_conf:.3f}")
187
- analysis['is_healthy_boundary'] = True
188
  else:
189
  logger.info(f"Boundary health check failed")
 
190
 
191
  # 4. Fallacy Detection
192
  logger.info("Running fallacy detection...")
 
168
  else:
169
  logger.info(f"No toxicity detected (pred: {toxicity_pred}, conf: {toxicity_conf})")
170
 
171
+ # 3. Boundary Health Check (0=Respected, 1=Violated, 2=Dismissed, 3=Manipulative)
172
  logger.info("Running boundary health check...")
173
  boundary_pred, boundary_conf = self.predict_with_model(text, 'boundary')
174
  if boundary_pred is not None:
175
+ if boundary_pred == 0: # 0 = Respected
176
+ logger.info(f"HEALTHY BOUNDARY DETECTED: confidence {boundary_conf:.3f}")
177
+ analysis['is_healthy_boundary'] = True
178
+ elif boundary_pred in [1, 2, 3] and boundary_conf > 0.7: # 1=Violated, 2=Dismissed, 3=Manipulative
179
+ boundary_type = {1: "Violated", 2: "Dismissed", 3: "Manipulative"}[boundary_pred]
180
+ logger.info(f"UNHEALTHY BOUNDARY DETECTED ({boundary_type}): confidence {boundary_conf:.3f}")
181
  analysis['is_healthy_boundary'] = False
182
  analysis['issues'].append({
183
  'type': 'unhealthy_boundary',
184
+ 'name': f'{boundary_type} Boundary Pattern',
185
  'confidence': boundary_conf,
186
  'severity': 2 if boundary_conf > 0.8 else 1
187
  })
188
  analysis['severity_score'] += 2 if boundary_conf > 0.8 else 1
 
 
 
189
  else:
190
  logger.info(f"Boundary health check failed")
191
+
192
 
193
  # 4. Fallacy Detection
194
  logger.info("Running fallacy detection...")