Commit
·
5c88b2d
1
Parent(s):
10d59a3
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
import gradio
|
2 |
import Levenshtein
|
3 |
|
4 |
-
def calculate_distance(
|
5 |
# split words and characters
|
6 |
-
ocr_words =
|
7 |
-
org_words =
|
8 |
-
ocr_chars = list(
|
9 |
-
org_chars = list(
|
10 |
cer = Levenshtein.distance(org_chars, ocr_chars) / len(org_chars)
|
11 |
return f"The Character Error Rate (CER): {cer}"
|
12 |
|
|
|
1 |
import gradio
|
2 |
import Levenshtein
|
3 |
|
4 |
+
def calculate_distance(orginal_text, ocr_text):
|
5 |
# split words and characters
|
6 |
+
ocr_words = ocr_text.split()
|
7 |
+
org_words = orginal_text.split()
|
8 |
+
ocr_chars = list(ocr_text)
|
9 |
+
org_chars = list(orginal_text)
|
10 |
cer = Levenshtein.distance(org_chars, ocr_chars) / len(org_chars)
|
11 |
return f"The Character Error Rate (CER): {cer}"
|
12 |
|