Svngoku commited on
Commit
66791db
·
verified ·
1 Parent(s): 0e88496

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -144,19 +144,25 @@ def create_visualization(results_dict):
144
  return summary_df, fig
145
 
146
  def evaluate_and_display(test_file, model_name):
147
- """
148
- Process uploaded file and run evaluation.
149
- """
150
  test_data = pd.read_json(test_file.name)
151
  preprocessed_data = preprocess_dataset(test_data.to_dict('records'))
152
 
 
153
  results = evaluate_afrimmlu(preprocessed_data, model_name)
154
 
 
155
  summary_df, plot = create_visualization(results)
156
- detailed_df = pd.read_csv('detailed_results.csv')
 
 
 
 
 
157
 
158
  return summary_df, plot, detailed_df
159
 
 
160
  def create_gradio_interface():
161
  """
162
  Create and configure the Gradio interface.
@@ -174,9 +180,9 @@ def create_gradio_interface():
174
  file_types=[".json"]
175
  )
176
  model_input = gr.Dropdown(
177
- choices=["deepseek-chat", "gpt-3.5-turbo", "gpt-4"],
178
  label="Select Model",
179
- value="deepseek-chat"
180
  )
181
  evaluate_btn = gr.Button("Evaluate", variant="primary")
182
 
 
144
  return summary_df, fig
145
 
146
  def evaluate_and_display(test_file, model_name):
147
+ # Load and preprocess data
 
 
148
  test_data = pd.read_json(test_file.name)
149
  preprocessed_data = preprocess_dataset(test_data.to_dict('records'))
150
 
151
+ # Run evaluation
152
  results = evaluate_afrimmlu(preprocessed_data, model_name)
153
 
154
+ # Create visualizations
155
  summary_df, plot = create_visualization(results)
156
+
157
+ # Load detailed results with error handling
158
+ try:
159
+ detailed_df = pd.read_csv('detailed_results.csv')
160
+ except (FileNotFoundError, pd.errors.EmptyDataError):
161
+ detailed_df = pd.DataFrame(results["detailed_results"])
162
 
163
  return summary_df, plot, detailed_df
164
 
165
+
166
  def create_gradio_interface():
167
  """
168
  Create and configure the Gradio interface.
 
180
  file_types=[".json"]
181
  )
182
  model_input = gr.Dropdown(
183
+ choices=["deepseek/deepseek-chat"],
184
  label="Select Model",
185
+ value="deepseek/deepseek-chat"
186
  )
187
  evaluate_btn = gr.Button("Evaluate", variant="primary")
188