esraa-abdelmaksoud
commited on
Commit
•
0898f20
1
Parent(s):
b08afbe
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import gradio
|
2 |
import Levenshtein
|
3 |
|
4 |
-
def calculate_distance(ocr_text,
|
5 |
ocr_string = ocr_text.replace("\n"," ")
|
6 |
original_string = original_text.replace("\n"," ")
|
7 |
-
distance = Levenshtein.distance(
|
8 |
cer = round(((distance/len(original_string))*100),2)
|
9 |
accuracy = 100-cer
|
10 |
return f"The Character Error Rate (CER): {cer}\nThe Accuracy: {accuracy}"
|
|
|
1 |
import gradio
|
2 |
import Levenshtein
|
3 |
|
4 |
+
def calculate_distance(ocr_text, original_text):
|
5 |
ocr_string = ocr_text.replace("\n"," ")
|
6 |
original_string = original_text.replace("\n"," ")
|
7 |
+
distance = Levenshtein.distance(ocr_string.lower(),original_string.lower())
|
8 |
cer = round(((distance/len(original_string))*100),2)
|
9 |
accuracy = 100-cer
|
10 |
return f"The Character Error Rate (CER): {cer}\nThe Accuracy: {accuracy}"
|