Neurolingua commited on
Commit
1a973b3
1 Parent(s): cc067c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -200,11 +200,11 @@ def get_student_profile():
200
 
201
 
202
  def calculate_score_and_grade(llm_response):
203
- pattern = r'Assigned marks: (\d+)/(\d+)'
204
- matches = re.findall(pattern, llm_response)
205
 
206
- total_score = sum(int(score) for score, max_score in matches)
207
- max_possible_score = sum(int(max_score) for score, max_score in matches)
208
 
209
  percentage = (total_score / max_possible_score) * 100 if max_possible_score > 0 else 0
210
 
@@ -222,6 +222,7 @@ def calculate_score_and_grade(llm_response):
222
  grade = 'Fail'
223
 
224
  return total_score, max_possible_score, percentage, grade
 
225
  @app.route('/student_reward_points')
226
  def student_reward_points():
227
  return render_template('student_reward_points.html')
 
200
 
201
 
202
  def calculate_score_and_grade(llm_response):
203
+ total_score=llm_response.split('\n')[1].split(' ')[-1]
204
+ max_possible_score=llm_response.split('\n')[0].split(' ')[-1]
205
 
206
+ total_score = int(total_score)
207
+ max_possible_score = int(max_possible_score)
208
 
209
  percentage = (total_score / max_possible_score) * 100 if max_possible_score > 0 else 0
210
 
 
222
  grade = 'Fail'
223
 
224
  return total_score, max_possible_score, percentage, grade
225
+
226
  @app.route('/student_reward_points')
227
  def student_reward_points():
228
  return render_template('student_reward_points.html')