AnishaG0201 commited on
Commit
3e4d080
1 Parent(s): 2a79bab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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
- score_line, feedback = evaluation.split('\n', 1)
185
- score = int(score_line.split()[-1])
 
 
 
 
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():