File size: 783 Bytes
da5284a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be65b2b
da5284a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import werpy
import gradio as gr

def word_error_rate(reference, hypothesis):
    normalized_reference = werpy.normalize(reference)
    normalized_hypothesis = werpy.normalize(hypothesis)
    wer_result = werpy.wer(normalized_reference, normalized_hypothesis)
    return wer_result

title = "Word Error Rate Calculator"
description = '''A simple application to quickly calculate the Word Error Rate (WER)'''
inputs=[
        gr.Textbox(type='str', lines=2, label="Input Reference Text"),
        gr.Textbox(type='str', lines=2, label="Input Hypothesis Text")    
    ]
outputs = gr.outputs.Textbox(label="Word Error Rate")

iface = gr.Interface(
    fn = word_error_rate, 
    inputs = inputs, 
    outputs = outputs,
    title = title,
    description = description
)
iface.launch()