Spaces:
Sleeping
Sleeping
Commit ·
bb1f78e
1
Parent(s): 2534871
Update code generation to use string consensus thresholds
Browse filesGenerate cleaner code with string values like "majority" instead of 0.5.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 |
-
|
|
|
|
|
|
|
| 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}
|