Spaces:
Sleeping
Sleeping
Commit
·
73ab035
1
Parent(s):
e324339
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
-
|
2 |
-
import
|
|
|
|
|
|
|
|
|
3 |
|
4 |
def word_error_rate(reference, hypothesis):
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
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>."
|