harshith1411 commited on
Commit
2c9296d
·
verified ·
1 Parent(s): 18c9994

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -67,17 +67,17 @@ def generate_quiz(standard, topic, quiz_type, difficulty, num_questions):
67
 
68
  try:
69
  response = model.predict(prompt) # AI Response
70
- st.write("🔹 **Raw API Response:**", response) # Debugging
71
  response = response.strip().replace("```json", "").replace("```", "") # Remove formatting if needed
72
  return json.loads(response) # Parse JSON safely
73
  except json.JSONDecodeError:
74
- st.error("⚠️ The AI did not return a valid JSON response. Trying again might help!")
75
  return None
76
  except Exception as e:
77
  st.error(f"⚠️ Error: {str(e)}")
78
  return None
79
 
80
 
 
81
  # Function to Calculate Score
82
  def calculate_score(user_answers, correct_answers):
83
  """Calculate score based on user answers."""
 
67
 
68
  try:
69
  response = model.predict(prompt) # AI Response
 
70
  response = response.strip().replace("```json", "").replace("```", "") # Remove formatting if needed
71
  return json.loads(response) # Parse JSON safely
72
  except json.JSONDecodeError:
73
+ st.error("⚠️ The AI did not return a valid JSON response. Try again!")
74
  return None
75
  except Exception as e:
76
  st.error(f"⚠️ Error: {str(e)}")
77
  return None
78
 
79
 
80
+
81
  # Function to Calculate Score
82
  def calculate_score(user_answers, correct_answers):
83
  """Calculate score based on user answers."""