huckiyang commited on
Commit
a364907
·
1 Parent(s): 88c90d9
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -229,15 +229,15 @@ def get_wer_metrics(dataset):
229
  rows = []
230
 
231
  # First add row for number of examples
232
- example_row = {"Metric": "Number of Examples"}
233
  for source in all_sources + ["OVERALL"]:
234
  example_row[source] = source_results[source]["Count"]
235
  rows.append(example_row)
236
 
237
- # Then add rows for each WER method
238
- no_lm_row = {"Metric": "Word Error Rate (No LM)"}
239
- lm_ranking_row = {"Metric": "Word Error Rate (N-gram Ranking)"}
240
- n_best_row = {"Metric": "Word Error Rate (Subwords Voting Correction)"}
241
 
242
  for source in all_sources + ["OVERALL"]:
243
  no_lm_row[source] = source_results[source]["No LM Baseline"]
@@ -259,14 +259,14 @@ def format_dataframe(df):
259
 
260
  # Find the rows containing WER values
261
  wer_row_indices = []
262
- for i, metric in enumerate(df["Metric"]):
263
- if "WER" in metric or "Error Rate" in metric:
264
  wer_row_indices.append(i)
265
 
266
  # Format WER values
267
  for idx in wer_row_indices:
268
  for col in df.columns:
269
- if col != "Metric":
270
  value = df.loc[idx, col]
271
  if pd.notna(value):
272
  df.loc[idx, col] = f"{value:.4f}"
@@ -289,6 +289,9 @@ with gr.Blocks(title="ASR Text Correction Leaderboard") as demo:
289
  with gr.Row():
290
  refresh_btn = gr.Button("Refresh Leaderboard")
291
 
 
 
 
292
  with gr.Row():
293
  try:
294
  initial_df = create_leaderboard()
 
229
  rows = []
230
 
231
  # First add row for number of examples
232
+ example_row = {"Methods": "Number of Examples"}
233
  for source in all_sources + ["OVERALL"]:
234
  example_row[source] = source_results[source]["Count"]
235
  rows.append(example_row)
236
 
237
+ # Then add rows for each WER method with simplified names
238
+ no_lm_row = {"Methods": "No LM"}
239
+ lm_ranking_row = {"Methods": "N-gram Ranking"}
240
+ n_best_row = {"Methods": "Subwords Voting"}
241
 
242
  for source in all_sources + ["OVERALL"]:
243
  no_lm_row[source] = source_results[source]["No LM Baseline"]
 
259
 
260
  # Find the rows containing WER values
261
  wer_row_indices = []
262
+ for i, method in enumerate(df["Methods"]):
263
+ if method not in ["Number of Examples"]:
264
  wer_row_indices.append(i)
265
 
266
  # Format WER values
267
  for idx in wer_row_indices:
268
  for col in df.columns:
269
+ if col != "Methods":
270
  value = df.loc[idx, col]
271
  if pd.notna(value):
272
  df.loc[idx, col] = f"{value:.4f}"
 
289
  with gr.Row():
290
  refresh_btn = gr.Button("Refresh Leaderboard")
291
 
292
+ with gr.Row():
293
+ gr.Markdown("### Word Error Rate (WER)")
294
+
295
  with gr.Row():
296
  try:
297
  initial_df = create_leaderboard()