esraa-abdelmaksoud commited on
Commit
0898f20
1 Parent(s): b08afbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,10 +1,10 @@
1
  import gradio
2
  import Levenshtein
3
 
4
- def calculate_distance(ocr_text, orginal_text):
5
  ocr_string = ocr_text.replace("\n"," ")
6
  original_string = original_text.replace("\n"," ")
7
- distance = Levenshtein.distance(ocr_text.lower(),orginal_text.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}"
 
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}"