Commit
·
da5284a
1
Parent(s):
41a8ad3
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)'''
|
12 |
+
inputs=[
|
13 |
+
gr.Textbox(type='str', lines=2, label="Input Reference Text"),
|
14 |
+
gr.Textbox(type='str', lines=2, label="Input Hypothesis Text")
|
15 |
+
]
|
16 |
+
outputs = gr.outputs.Textbox(label="Word Error Rate")
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn = word_error_rate,
|
20 |
+
inputs = inputs,
|
21 |
+
outputs = outputs
|
22 |
+
title = title,
|
23 |
+
description = description
|
24 |
+
)
|
25 |
+
iface.launch()
|