chrissoria Claude Opus 4.5 commited on
Commit
bb1f78e
·
1 Parent(s): 2534871

Update code generation to use string consensus thresholds

Browse files

Generate cleaner code with string values like "majority" instead of 0.5.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -309,7 +309,9 @@ result.to_csv("classified_results.csv", index=False)
309
  models_str = '("gpt-4o", "auto", "YOUR_API_KEY"),\n ("claude-sonnet-4-5-20250929", "auto", "YOUR_API_KEY")'
310
 
311
  mode_param = f',\n mode="{mode}"' if mode and input_type == "pdf" else ''
312
- consensus_param = f',\n consensus_threshold={consensus_threshold} # {"Majority" if consensus_threshold == 0.5 else "Two-Thirds" if consensus_threshold == 0.67 else "Unanimous"}' if classify_mode == "Ensemble" else ''
 
 
313
 
314
  return f'''import catllm
315
  {load_data}
 
309
  models_str = '("gpt-4o", "auto", "YOUR_API_KEY"),\n ("claude-sonnet-4-5-20250929", "auto", "YOUR_API_KEY")'
310
 
311
  mode_param = f',\n mode="{mode}"' if mode and input_type == "pdf" else ''
312
+ # Map numeric threshold back to string for cleaner code
313
+ threshold_str = "majority" if consensus_threshold == 0.5 else "two-thirds" if consensus_threshold == 0.67 else "unanimous"
314
+ consensus_param = f',\n consensus_threshold="{threshold_str}"' if classify_mode == "Ensemble" else ''
315
 
316
  return f'''import catllm
317
  {load_data}