None1145 commited on
Commit
6f014a9
·
verified ·
1 Parent(s): d7a8d6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -15,21 +15,27 @@ def compare_csv_files():
15
  f"1.4 is stronger than 1.5 ({-x:.8f})" if x > 0 else "1.4 is the same as 1.5 (0)"
16
  )
17
  )
18
-
19
  merged_df["CharacterErrorRate_Comparison"] = merged_df["CharacterErrorRate_Diff"].apply(
20
  lambda x: f"1.5 is stronger than 1.4 ({x:.8f})" if x < 0 else (
21
  f"1.4 is stronger than 1.5 ({-x:.8f})" if x > 0 else "1.4 is the same as 1.5 (0)"
22
  )
23
  )
24
 
 
 
 
 
 
 
 
 
25
  result = merged_df[[
26
  "SourceText",
27
  "WordErrorRate_1.5", "WordErrorRate_1.4", "WordErrorRate_Comparison",
28
  "CharacterErrorRate_1.5", "CharacterErrorRate_1.4", "CharacterErrorRate_Comparison"
29
  ]]
30
 
31
- return result.to_html(index=False)
32
-
33
 
34
  gr.Interface(
35
  fn=compare_csv_files,
 
15
  f"1.4 is stronger than 1.5 ({-x:.8f})" if x > 0 else "1.4 is the same as 1.5 (0)"
16
  )
17
  )
 
18
  merged_df["CharacterErrorRate_Comparison"] = merged_df["CharacterErrorRate_Diff"].apply(
19
  lambda x: f"1.5 is stronger than 1.4 ({x:.8f})" if x < 0 else (
20
  f"1.4 is stronger than 1.5 ({-x:.8f})" if x > 0 else "1.4 is the same as 1.5 (0)"
21
  )
22
  )
23
 
24
+ avg_word_diff = merged_df["WordErrorRate_Diff"].mean()
25
+ avg_char_diff = merged_df["CharacterErrorRate_Diff"].mean()
26
+ overall_summary = f"""
27
+ <h3>Overall Comparison:</h3>
28
+ <p>Average WordErrorRate Difference: {'1.5 is stronger' if avg_word_diff < 0 else '1.4 is stronger'} ({avg_word_diff:.8f})</p>
29
+ <p>Average CharacterErrorRate Difference: {'1.5 is stronger' if avg_char_diff < 0 else '1.4 is stronger'} ({avg_char_diff:.8f})</p>
30
+ """
31
+
32
  result = merged_df[[
33
  "SourceText",
34
  "WordErrorRate_1.5", "WordErrorRate_1.4", "WordErrorRate_Comparison",
35
  "CharacterErrorRate_1.5", "CharacterErrorRate_1.4", "CharacterErrorRate_Comparison"
36
  ]]
37
 
38
+ return overall_summary + result.to_html(index=False)
 
39
 
40
  gr.Interface(
41
  fn=compare_csv_files,