Spaces:
Sleeping
Sleeping
add spaces
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
|
|
|
|
| 4 |
def calculate_wer(reference, hypothesis):
|
| 5 |
reference_words = reference.split()
|
| 6 |
hypothesis_words = hypothesis.split()
|
|
@@ -28,6 +30,7 @@ def calculate_wer(reference, hypothesis):
|
|
| 28 |
wer = dp[m][n] / m
|
| 29 |
return wer
|
| 30 |
|
|
|
|
| 31 |
def calculate_cer(reference, hypothesis):
|
| 32 |
reference = reference.replace(" ", "")
|
| 33 |
hypothesis = hypothesis.replace(" ", "")
|
|
@@ -55,11 +58,13 @@ def calculate_cer(reference, hypothesis):
|
|
| 55 |
cer = dp[m][n] / m
|
| 56 |
return cer
|
| 57 |
|
|
|
|
| 58 |
def calculate_mer(reference, hypothesis):
|
| 59 |
# Custom mission error rate calculation
|
| 60 |
# Replace this with your specific logic
|
| 61 |
return 0.0
|
| 62 |
|
|
|
|
| 63 |
def process_files(reference_file, hypothesis_file):
|
| 64 |
try:
|
| 65 |
with open(reference_file.name, 'r') as f:
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
+
@spaces.GPU()
|
| 6 |
def calculate_wer(reference, hypothesis):
|
| 7 |
reference_words = reference.split()
|
| 8 |
hypothesis_words = hypothesis.split()
|
|
|
|
| 30 |
wer = dp[m][n] / m
|
| 31 |
return wer
|
| 32 |
|
| 33 |
+
@spaces.GPU()
|
| 34 |
def calculate_cer(reference, hypothesis):
|
| 35 |
reference = reference.replace(" ", "")
|
| 36 |
hypothesis = hypothesis.replace(" ", "")
|
|
|
|
| 58 |
cer = dp[m][n] / m
|
| 59 |
return cer
|
| 60 |
|
| 61 |
+
@spaces.GPU()
|
| 62 |
def calculate_mer(reference, hypothesis):
|
| 63 |
# Custom mission error rate calculation
|
| 64 |
# Replace this with your specific logic
|
| 65 |
return 0.0
|
| 66 |
|
| 67 |
+
@spaces.GPU()
|
| 68 |
def process_files(reference_file, hypothesis_file):
|
| 69 |
try:
|
| 70 |
with open(reference_file.name, 'r') as f:
|