None1145 commited on
Commit
a8dfc6b
·
verified ·
1 Parent(s): b4b8fc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import pandas as pd
2
  import gradio as gr
 
3
 
4
  def compare_csv_files(max_num):
5
  df1 = pd.read_csv("fish-speech-1.5.csv")
@@ -33,20 +34,37 @@ def compare_csv_files(max_num):
33
  <p>Average CharacterErrorRate Difference (excluding large diffs): {f'1.5 is stronger ({avg_char_diff:.8f})' if avg_char_diff < 0 else f'1.4 is stronger ({0 - avg_char_diff:.8f})'}</p>
34
  """
35
 
 
 
 
 
 
 
 
 
 
 
36
  result = merged_df[[
37
  "SourceText",
38
  "WordErrorRate_1.5", "WordErrorRate_1.4", "WordErrorRate_Comparison",
39
  "CharacterErrorRate_1.5", "CharacterErrorRate_1.4", "CharacterErrorRate_Comparison",
40
  "WhisperText_1.5", "WhisperText_1.4"
41
  ]]
 
 
 
 
 
 
 
42
 
43
- return overall_summary + result.to_html(index=False)
44
 
45
  max_num = gr.Number(value=10)
46
  gr.Interface(
47
  fn=compare_csv_files,
48
  inputs=[max_num],
49
- outputs="html",
50
  title="Fish Speech Benchmark",
51
- description="This is a non official model performance test from Fish Speech / Whisper Base / More data will be added later (not too much)"
52
  ).launch()
 
1
  import pandas as pd
2
  import gradio as gr
3
+ import os
4
 
5
  def compare_csv_files(max_num):
6
  df1 = pd.read_csv("fish-speech-1.5.csv")
 
34
  <p>Average CharacterErrorRate Difference (excluding large diffs): {f'1.5 is stronger ({avg_char_diff:.8f})' if avg_char_diff < 0 else f'1.4 is stronger ({0 - avg_char_diff:.8f})'}</p>
35
  """
36
 
37
+ def get_audio_files(uuid):
38
+ file_1_5 = os.path.join("fish-speech-1.5", f"{uuid}.wav")
39
+ file_1_4 = os.path.join("fish-speech-1.4", f"{uuid}.wav")
40
+ return file_1_5, file_1_4
41
+
42
+ audio_files = []
43
+ for uuid in merged_df["SourceText"]:
44
+ file_1_5, file_1_4 = get_audio_files(uuid)
45
+ audio_files.append((file_1_5, file_1_4))
46
+
47
  result = merged_df[[
48
  "SourceText",
49
  "WordErrorRate_1.5", "WordErrorRate_1.4", "WordErrorRate_Comparison",
50
  "CharacterErrorRate_1.5", "CharacterErrorRate_1.4", "CharacterErrorRate_Comparison",
51
  "WhisperText_1.5", "WhisperText_1.4"
52
  ]]
53
+
54
+ # Add audio columns to the result for Gradio interface
55
+ audio_columns = [
56
+ gr.Audio(value=file_1_5) for file_1_5, _ in audio_files
57
+ ] + [
58
+ gr.Audio(value=file_1_4) for _, file_1_4 in audio_files
59
+ ]
60
 
61
+ return overall_summary + result.to_html(index=False), *audio_columns
62
 
63
  max_num = gr.Number(value=10)
64
  gr.Interface(
65
  fn=compare_csv_files,
66
  inputs=[max_num],
67
+ outputs=["html"] + [gr.Audio() for _ in range(len(df1))], # Dynamically add audio outputs
68
  title="Fish Speech Benchmark",
69
+ description="This is a non-official model performance test from Fish Speech / Whisper Base / More data will be added later (not too much)"
70
  ).launch()