Update app.py
Browse files
app.py
CHANGED
|
@@ -181,8 +181,12 @@ def evaluate_answer(question, user_answer):
|
|
| 181 |
|
| 182 |
evaluation = response.content
|
| 183 |
# Extract score and feedback from the evaluation
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
return score, feedback
|
| 187 |
|
| 188 |
def generate_report():
|
|
|
|
| 181 |
|
| 182 |
evaluation = response.content
|
| 183 |
# Extract score and feedback from the evaluation
|
| 184 |
+
# Extract score using regular expressions
|
| 185 |
+
score_match = re.search(r'(\d+)/100', evaluation)
|
| 186 |
+
score = int(score_match.group(1)) if score_match else 0
|
| 187 |
+
|
| 188 |
+
# Extract feedback
|
| 189 |
+
feedback = evaluation.split('\n', 1)[1] if '\n' in evaluation else evaluation
|
| 190 |
return score, feedback
|
| 191 |
|
| 192 |
def generate_report():
|