rossarmstrong commited on
Commit
73ab035
·
1 Parent(s): e324339

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -1,11 +1,18 @@
1
- import werpy
2
- import gradio as gr
 
 
 
 
3
 
4
  def word_error_rate(reference, hypothesis):
5
- normalized_reference = werpy.normalize(reference)
6
- normalized_hypothesis = werpy.normalize(hypothesis)
7
- wer_result = werpy.wer(normalized_reference, normalized_hypothesis)
8
- return wer_result
 
 
 
9
 
10
  title = "Word Error Rate Calculator"
11
  description = "A simple application to quickly calculate the Word Error Rate (WER) powered by <a href='https://pypi.org/project/werpy/'>werpy</a>."
 
1
+ try:
2
+ import werpy
3
+ import gradio as gr
4
+ except ImportError as e:
5
+ print(f"An error occurred while importing modules: {str(e)}")
6
+ exit()
7
 
8
  def word_error_rate(reference, hypothesis):
9
+ try:
10
+ normalized_reference = werpy.normalize(reference)
11
+ normalized_hypothesis = werpy.normalize(hypothesis)
12
+ wer_result = werpy.wer(normalized_reference, normalized_hypothesis)
13
+ return wer_result
14
+ except Exception as e:
15
+ return f"An error occurred: {str(e)}"
16
 
17
  title = "Word Error Rate Calculator"
18
  description = "A simple application to quickly calculate the Word Error Rate (WER) powered by <a href='https://pypi.org/project/werpy/'>werpy</a>."