esraa-abdelmaksoud commited on
Commit
5c88b2d
·
1 Parent(s): 10d59a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio
2
  import Levenshtein
3
 
4
- def calculate_distance(org_text, ocr_str):
5
  # split words and characters
6
- ocr_words = ocr_str.split()
7
- org_words = org_str.split()
8
- ocr_chars = list(ocr_str)
9
- org_chars = list(org_str)
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