Spaces:
Sleeping
Sleeping
Update run_evaluation.py
Browse files- run_evaluation.py +24 -27
run_evaluation.py
CHANGED
|
@@ -119,37 +119,34 @@ def run_mmlu_evaluation(subject_selection_mode, num_subjects, selected_subjects,
|
|
| 119 |
comparison_df = pd.DataFrame(comparison_data)
|
| 120 |
|
| 121 |
# Format the report
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
f"* Evaluation completed in {model2_elapsed_time:.2f} seconds\n\n"
|
| 134 |
-
f"#### Overall Winner: {overall_winner}\n"
|
| 135 |
-
f"* Margin: {abs(overall_diff):.3f}\n"
|
| 136 |
)
|
| 137 |
-
|
| 138 |
-
# Return values that re-enable UI components after completion
|
| 139 |
-
return {
|
| 140 |
-
'report': report,
|
| 141 |
-
'comparison_df': comparison_df,
|
| 142 |
-
'success': True
|
| 143 |
-
}
|
| 144 |
|
| 145 |
except Exception as e:
|
| 146 |
# Handle errors gracefully
|
| 147 |
error_trace = traceback.format_exc()
|
| 148 |
error_message = f"### Error during evaluation\n```\n{error_trace}\n```"
|
| 149 |
|
| 150 |
-
# Return error
|
| 151 |
-
return
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
comparison_df = pd.DataFrame(comparison_data)
|
| 120 |
|
| 121 |
# Format the report
|
| 122 |
+
return (
|
| 123 |
+
report, # Report markdown
|
| 124 |
+
comparison_df, # Results dataframe
|
| 125 |
+
gr.Button.update(interactive=True), # Enable eval button
|
| 126 |
+
gr.Button.update(interactive=False), # Disable cancel button
|
| 127 |
+
gr.Radio.update(interactive=True), # Enable subject selection mode
|
| 128 |
+
gr.Slider.update(interactive=True), # Enable subjects slider
|
| 129 |
+
gr.Checkbox.update(interactive=True), # Enable all questions checkbox
|
| 130 |
+
gr.Slider.update(interactive=True), # Enable questions slider
|
| 131 |
+
gr.Dropdown.update(interactive=True), # Enable model dropdown
|
| 132 |
+
gr.Column.update(visible=True) # Make table container visible
|
|
|
|
|
|
|
|
|
|
| 133 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
except Exception as e:
|
| 136 |
# Handle errors gracefully
|
| 137 |
error_trace = traceback.format_exc()
|
| 138 |
error_message = f"### Error during evaluation\n```\n{error_trace}\n```"
|
| 139 |
|
| 140 |
+
# Return error values for all 10 components
|
| 141 |
+
return (
|
| 142 |
+
error_message, # Error message in markdown
|
| 143 |
+
None, # No dataframe
|
| 144 |
+
gr.Button.update(interactive=True), # Enable eval button
|
| 145 |
+
gr.Button.update(interactive=False), # Disable cancel button
|
| 146 |
+
gr.Radio.update(interactive=True), # Enable subject selection mode
|
| 147 |
+
gr.Slider.update(interactive=True), # Enable subjects slider
|
| 148 |
+
gr.Checkbox.update(interactive=True), # Enable all questions checkbox
|
| 149 |
+
gr.Slider.update(interactive=True), # Enable questions slider
|
| 150 |
+
gr.Dropdown.update(interactive=True), # Enable model dropdown
|
| 151 |
+
gr.Column.update(visible=False) # Hide table container
|
| 152 |
+
)
|