sanchit-gandhi commited on
Commit
65f6dc4
·
1 Parent(s): eed20cf

make style

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -74,9 +74,11 @@ def get_visualisation(idx, model="large-v2", round_dp=2, ngram_degree=5):
74
  if model == "large-v2":
75
  text2 = norm_pred_v2[idx]
76
  elif model == "large-32-2":
77
- text2 = norm_pred_32_2[idx]
78
  else:
79
- raise ValueError(f"Got unknown model {model}, should be one of `'large-v2'` or `'large-32-2'`.")
 
 
80
 
81
  wer_output = process_words(text1, text2, wer_default, wer_default)
82
  wer_percentage = round(100 * wer_output.wer, round_dp)
@@ -96,7 +98,13 @@ def get_visualisation(idx, model="large-v2", round_dp=2, ngram_degree=5):
96
  diff = compare_string(text1, text2)
97
  full_text = style_text(diff)
98
 
99
- return (sampling_rate, array), wer_percentage, ier_percentage, repeated_ngrams, full_text
 
 
 
 
 
 
100
 
101
 
102
  def get_side_by_side_visualisation(idx):
@@ -128,7 +136,7 @@ if __name__ == "__main__":
128
  """
129
  )
130
  gr.Markdown(
131
- "Analyse the transcriptions generated by the Whisper large-v2 and large-32-2 models on the TEDLIUM dev set."
132
  "The transcriptions for both models are shown at the bottom of the demo. The text diff for each is computed "
133
  "relative to the target transcriptions. Insertions are displayed in <span style='background-color:Lightgreen'>green</span>, and "
134
  "deletions in <span style='background-color:#FFCCCB'><s>red</s></span>."
 
74
  if model == "large-v2":
75
  text2 = norm_pred_v2[idx]
76
  elif model == "large-32-2":
77
+ text2 = norm_pred_32_2[idx]
78
  else:
79
+ raise ValueError(
80
+ f"Got unknown model {model}, should be one of `'large-v2'` or `'large-32-2'`."
81
+ )
82
 
83
  wer_output = process_words(text1, text2, wer_default, wer_default)
84
  wer_percentage = round(100 * wer_output.wer, round_dp)
 
98
  diff = compare_string(text1, text2)
99
  full_text = style_text(diff)
100
 
101
+ return (
102
+ (sampling_rate, array),
103
+ wer_percentage,
104
+ ier_percentage,
105
+ repeated_ngrams,
106
+ full_text,
107
+ )
108
 
109
 
110
  def get_side_by_side_visualisation(idx):
 
136
  """
137
  )
138
  gr.Markdown(
139
+ "Analyse the transcriptions generated by the Whisper large-v2 and large-32-2 models on the TEDLIUM dev set. "
140
  "The transcriptions for both models are shown at the bottom of the demo. The text diff for each is computed "
141
  "relative to the target transcriptions. Insertions are displayed in <span style='background-color:Lightgreen'>green</span>, and "
142
  "deletions in <span style='background-color:#FFCCCB'><s>red</s></span>."