joshuarauh commited on
Commit
ab22698
·
verified ·
1 Parent(s): 49a9551

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -533,7 +533,9 @@ def get_solution_for_verification(response_text, sympy_correct, final_verificati
533
  logger.error("Could not find question markers")
534
  return response_text.strip()
535
 
 
536
  question = response_text[q_start:q_end].strip()
 
537
 
538
  # If no sympy verification was done, treat as correct and use original
539
  if sympy_correct is None:
@@ -541,7 +543,6 @@ def get_solution_for_verification(response_text, sympy_correct, final_verificati
541
 
542
  if sympy_correct:
543
  # Use original solution - need to extract before SymPy code
544
- original_solution = parts[1]
545
  sympy_start = original_solution.find('```python')
546
  if sympy_start != -1:
547
  solution = original_solution[:sympy_start].strip()
@@ -559,10 +560,10 @@ def get_solution_for_verification(response_text, sympy_correct, final_verificati
559
  solution = final_verification.strip()
560
  else:
561
  # Fallback to original if no final verification
562
- solution = parts[1].strip()
563
 
564
  # Combine question and appropriate solution
565
- complete_text = f"{question}\n\nSolution:\n{solution}"
566
  return complete_text
567
 
568
  def verify_with_chatgpt(question_and_solution):
@@ -585,7 +586,7 @@ Analyze the following aspects:
585
  - Are edge cases addressed?
586
  - Are all required steps shown?
587
 
588
- 3. Clarity and Presentation (20 points):
589
  - Is the solution well-organized?
590
  - Are steps clearly explained?
591
  - Is mathematical notation used correctly?
@@ -608,7 +609,7 @@ Format your response with clear headers and bullet points."""
608
 
609
  # Call OpenAI API
610
  response = openai.ChatCompletion.create(
611
- model="gpt-4o", # Using GPT-4o model
612
  messages=[
613
  {"role": "system", "content": "You are an expert mathematics professor grading student solutions."},
614
  {"role": "user", "content": verification_prompt}
 
533
  logger.error("Could not find question markers")
534
  return response_text.strip()
535
 
536
+ # Extract question and solution sections
537
  question = response_text[q_start:q_end].strip()
538
+ original_solution = response_text[q_end:]
539
 
540
  # If no sympy verification was done, treat as correct and use original
541
  if sympy_correct is None:
 
543
 
544
  if sympy_correct:
545
  # Use original solution - need to extract before SymPy code
 
546
  sympy_start = original_solution.find('```python')
547
  if sympy_start != -1:
548
  solution = original_solution[:sympy_start].strip()
 
560
  solution = final_verification.strip()
561
  else:
562
  # Fallback to original if no final verification
563
+ solution = original_solution.strip()
564
 
565
  # Combine question and appropriate solution
566
+ complete_text = f"{question}\n\n{solution}"
567
  return complete_text
568
 
569
  def verify_with_chatgpt(question_and_solution):
 
586
  - Are edge cases addressed?
587
  - Are all required steps shown?
588
 
589
+ 3. Clarity and Presentation (10 points):
590
  - Is the solution well-organized?
591
  - Are steps clearly explained?
592
  - Is mathematical notation used correctly?
 
609
 
610
  # Call OpenAI API
611
  response = openai.ChatCompletion.create(
612
+ model="gpt-4o", # Using GPT-4 Omega model
613
  messages=[
614
  {"role": "system", "content": "You are an expert mathematics professor grading student solutions."},
615
  {"role": "user", "content": verification_prompt}