Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import keras
|
|
| 7 |
from huggingface_hub import snapshot_download
|
| 8 |
import pytesseract
|
| 9 |
import io
|
|
|
|
| 10 |
import matplotlib
|
| 11 |
matplotlib.use("Agg")
|
| 12 |
import matplotlib.pyplot as plt
|
|
@@ -108,7 +109,8 @@ def compute_attention_scores(saliency_map):
|
|
| 108 |
|
| 109 |
|
| 110 |
def compute_readability_score(read):
|
| 111 |
-
|
|
|
|
| 112 |
|
| 113 |
|
| 114 |
def compute_overall_grade(focus_score, spread_score, readability_score):
|
|
|
|
| 7 |
from huggingface_hub import snapshot_download
|
| 8 |
import pytesseract
|
| 9 |
import io
|
| 10 |
+
import math
|
| 11 |
import matplotlib
|
| 12 |
matplotlib.use("Agg")
|
| 13 |
import matplotlib.pyplot as plt
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
def compute_readability_score(read):
|
| 112 |
+
penalty = 12 * math.sqrt(read['contrast_issues']) + 8 * math.sqrt(read['small_text_issues'])
|
| 113 |
+
return round(max(0, 100 - penalty), 1)
|
| 114 |
|
| 115 |
|
| 116 |
def compute_overall_grade(focus_score, spread_score, readability_score):
|