Spaces:
Runtime error
Runtime error
Updated grammar for reading level
Browse files
app.py
CHANGED
|
@@ -200,13 +200,13 @@ def predict(text, tokenizer=tokenizer):
|
|
| 200 |
|
| 201 |
def level(score):
|
| 202 |
if score <= 3:
|
| 203 |
-
return "Elementary School"
|
| 204 |
elif 3 <= score <= 6:
|
| 205 |
-
return "Middle School"
|
| 206 |
elif 6 <= score <= 8:
|
| 207 |
-
return "High School"
|
| 208 |
else:
|
| 209 |
-
return "College"
|
| 210 |
|
| 211 |
|
| 212 |
def reading_difficulty(excerpt):
|
|
@@ -227,13 +227,13 @@ def reading_difficulty(excerpt):
|
|
| 227 |
win_preds.append(predict(text, tokenizer).item())
|
| 228 |
result = np.mean(win_preds)
|
| 229 |
score = -(result * 1.786 + 6.4) + 10
|
| 230 |
-
return "Difficulty Level: " + str(round(score, 2)) + '/10' + ' | A
|
| 231 |
level(score)) + " student could understand this"
|
| 232 |
|
| 233 |
else:
|
| 234 |
result = predict(excerpt).item()
|
| 235 |
score = -(result * 1.786 + 6.4) + 10
|
| 236 |
-
return 'Difficulty Level: ' + str(round(score, 2)) + '/10' + ' | A
|
| 237 |
level(score)) + " student could understand this"
|
| 238 |
|
| 239 |
|
|
|
|
| 200 |
|
| 201 |
def level(score):
|
| 202 |
if score <= 3:
|
| 203 |
+
return "n Elementary School"
|
| 204 |
elif 3 <= score <= 6:
|
| 205 |
+
return " Middle School"
|
| 206 |
elif 6 <= score <= 8:
|
| 207 |
+
return " High School"
|
| 208 |
else:
|
| 209 |
+
return " College"
|
| 210 |
|
| 211 |
|
| 212 |
def reading_difficulty(excerpt):
|
|
|
|
| 227 |
win_preds.append(predict(text, tokenizer).item())
|
| 228 |
result = np.mean(win_preds)
|
| 229 |
score = -(result * 1.786 + 6.4) + 10
|
| 230 |
+
return "Difficulty Level: " + str(round(score, 2)) + '/10' + ' | A' + str(
|
| 231 |
level(score)) + " student could understand this"
|
| 232 |
|
| 233 |
else:
|
| 234 |
result = predict(excerpt).item()
|
| 235 |
score = -(result * 1.786 + 6.4) + 10
|
| 236 |
+
return 'Difficulty Level: ' + str(round(score, 2)) + '/10' + ' | A' + str(
|
| 237 |
level(score)) + " student could understand this"
|
| 238 |
|
| 239 |
|