esraa-abdelmaksoud commited on
Commit
82ff96e
·
1 Parent(s): 404da8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -2,12 +2,7 @@ import gradio
2
  import Levenshtein
3
 
4
  def calculate_distance(ocr_text, orginal_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 = round(((Levenshtein.distance(org_chars.lower(), ocr_chars.lower()) / len(org_chars))*100),2)
11
  accuracy = 100-cer
12
  return f"The Character Error Rate (CER): {cer}\n The Accuracy: {accuracy}"
13
 
 
2
  import Levenshtein
3
 
4
  def calculate_distance(ocr_text, orginal_text):
5
+ cer = round(((Levenshtein.distance(orginal_text.lower(), ocr_text.lower()) / len(orginal_text))*100),2)
 
 
 
 
 
6
  accuracy = 100-cer
7
  return f"The Character Error Rate (CER): {cer}\n The Accuracy: {accuracy}"
8