mskov commited on
Commit
6c847d8
Β·
1 Parent(s): 20ee2cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -33,7 +33,7 @@ model = WhisperForConditionalGeneration.from_pretrained("mskov/whisper-small-esc
33
 
34
  # Remove brackets and extra spaces
35
 
36
-
37
  def map_to_pred(batch):
38
  cleaned_transcription = re.sub(r'\[[^\]]+\]', '', batch['category']).strip()
39
  print("cleaned transcript", cleaned_transcription)
@@ -69,11 +69,12 @@ labels = dataset["audio"] # Replace "labels" with the appropriate key in your d
69
  print("labels are ", labels)
70
 
71
  # Compute WER
 
72
  wer_score = wer(labels, predicted_text)
73
 
74
  # Print or return WER score
75
  print(f"Word Error Rate (WER): {wer_score}")
76
- '''
77
 
78
  def transcribe(audio):
79
  text = pipe(audio)["text"]
 
33
 
34
  # Remove brackets and extra spaces
35
 
36
+ '''
37
  def map_to_pred(batch):
38
  cleaned_transcription = re.sub(r'\[[^\]]+\]', '', batch['category']).strip()
39
  print("cleaned transcript", cleaned_transcription)
 
69
  print("labels are ", labels)
70
 
71
  # Compute WER
72
+ wer = load("wer")
73
  wer_score = wer(labels, predicted_text)
74
 
75
  # Print or return WER score
76
  print(f"Word Error Rate (WER): {wer_score}")
77
+
78
 
79
  def transcribe(audio):
80
  text = pipe(audio)["text"]