Commit ·
c9b82ca
1
Parent(s): aabf65f
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,9 @@ def calculate_distance(ocr_text, orginal_text):
|
|
| 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 |
-
|
|
|
|
| 12 |
|
| 13 |
iface = gradio.Interface(
|
| 14 |
fn=calculate_distance,
|
|
|
|
| 7 |
org_words = orginal_text.split()
|
| 8 |
ocr_chars = list(ocr_text)
|
| 9 |
org_chars = list(orginal_text)
|
| 10 |
+
cer = round((Levenshtein.distance(org_chars, ocr_chars) / len(org_chars)),2)
|
| 11 |
+
accuracy = 100-cer
|
| 12 |
+
return f"The Character Error Rate (CER): {cer}\n The Accuracy: {accuracy}"
|
| 13 |
|
| 14 |
iface = gradio.Interface(
|
| 15 |
fn=calculate_distance,
|