Spaces:
Sleeping
Sleeping
add spaces
Browse files
app.py
CHANGED
@@ -1,17 +1,21 @@
|
|
|
|
1 |
import jiwer
|
2 |
import numpy as np
|
3 |
import gradio as gr
|
4 |
|
|
|
5 |
def calculate_wer(reference, hypothesis):
|
6 |
reference_str = " ".join(reference)
|
7 |
hypothesis_str = " ".join(hypothesis)
|
8 |
return jiwer.wer(reference_str, hypothesis_str)
|
9 |
|
|
|
10 |
def calculate_cer(reference, hypothesis):
|
11 |
reference_str = " ".join(reference)
|
12 |
hypothesis_str = " ".join(hypothesis)
|
13 |
return jiwer.cer(reference_str, hypothesis_str)
|
14 |
|
|
|
15 |
def calculate_sentence_metrics(reference, hypothesis):
|
16 |
reference_sentences = [line.strip() for line in reference]
|
17 |
hypothesis_sentences = [line.strip() for line in hypothesis]
|
|
|
1 |
+
import spaces
|
2 |
import jiwer
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
5 |
|
6 |
+
@spaces.GPU()
|
7 |
def calculate_wer(reference, hypothesis):
|
8 |
reference_str = " ".join(reference)
|
9 |
hypothesis_str = " ".join(hypothesis)
|
10 |
return jiwer.wer(reference_str, hypothesis_str)
|
11 |
|
12 |
+
@spaces.GPU()
|
13 |
def calculate_cer(reference, hypothesis):
|
14 |
reference_str = " ".join(reference)
|
15 |
hypothesis_str = " ".join(hypothesis)
|
16 |
return jiwer.cer(reference_str, hypothesis_str)
|
17 |
|
18 |
+
@spaces.GPU()
|
19 |
def calculate_sentence_metrics(reference, hypothesis):
|
20 |
reference_sentences = [line.strip() for line in reference]
|
21 |
hypothesis_sentences = [line.strip() for line in hypothesis]
|