dror44 commited on
Commit
2ea847d
·
1 Parent(s): 0bcfec8
Files changed (1) hide show
  1. src/app.py +15 -4
src/app.py CHANGED
@@ -19,7 +19,8 @@ current_test_type: str = "grounding"
19
 
20
  def format_leaderboard_for_display(df: pd.DataFrame) -> pd.DataFrame:
21
  """Format the leaderboard dataframe for display in the UI.
22
- This ensures consistent display across environments like Huggingface Spaces."""
 
23
  # Create a copy of the dataframe with only the columns we want to display
24
  display_df = pd.DataFrame()
25
  display_df["Judge Name"] = df["judge_name"]
@@ -314,7 +315,6 @@ def get_evaluation2(
314
  # Display the evaluation (time is already included in the evaluation)
315
  display_eval = eval2["display_evaluation"]
316
 
317
- # Make the selection button visible once the evaluation is ready and show additional buttons
318
  return (
319
  display_eval,
320
  gr.update(visible=True),
@@ -322,7 +322,15 @@ def get_evaluation2(
322
  )
323
  except Exception as e:
324
  logger.error(f"Error getting evaluation 2: {e}")
325
- return f"Error: {str(e)}", gr.update(visible=False), gr.update(visible=False)
 
 
 
 
 
 
 
 
326
 
327
 
328
  def format_inputs_for_evaluation(
@@ -391,7 +399,10 @@ def save_to_history(
391
  history_df = pd.DataFrame(columns=list(history_row.keys()))
392
 
393
  # Append the new row
394
- history_df = pd.concat([history_df, pd.DataFrame([history_row])], ignore_index=True)
 
 
 
395
 
396
  # Save to CSV
397
  history_df.to_csv(HISTORY_PATH, index=False)
 
19
 
20
  def format_leaderboard_for_display(df: pd.DataFrame) -> pd.DataFrame:
21
  """Format the leaderboard dataframe for display in the UI.
22
+ This ensures consistent display across environments
23
+ like Huggingface Spaces."""
24
  # Create a copy of the dataframe with only the columns we want to display
25
  display_df = pd.DataFrame()
26
  display_df["Judge Name"] = df["judge_name"]
 
315
  # Display the evaluation (time is already included in the evaluation)
316
  display_eval = eval2["display_evaluation"]
317
 
 
318
  return (
319
  display_eval,
320
  gr.update(visible=True),
 
322
  )
323
  except Exception as e:
324
  logger.error(f"Error getting evaluation 2: {e}")
325
+ return (
326
+ f"Error: {str(e)}",
327
+ gr.update(
328
+ visible=False,
329
+ ),
330
+ gr.update(
331
+ visible=False,
332
+ ),
333
+ )
334
 
335
 
336
  def format_inputs_for_evaluation(
 
399
  history_df = pd.DataFrame(columns=list(history_row.keys()))
400
 
401
  # Append the new row
402
+ history_df = pd.concat(
403
+ [history_df, pd.DataFrame([history_row])],
404
+ ignore_index=True,
405
+ )
406
 
407
  # Save to CSV
408
  history_df.to_csv(HISTORY_PATH, index=False)