capradeepgujaran commited on
Commit
c4f6561
1 Parent(s): edec330

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -233,6 +233,19 @@ class QuizApp:
233
  self.quiz_generator = QuizGenerator(api_key)
234
  self.certificate_generator = CertificateGenerator()
235
  self.current_questions: List[Question] = []
 
 
 
 
 
 
 
 
 
 
 
 
 
236
 
237
  def update_questions(self, text: str, num_questions: int) -> Tuple[gr.update, gr.update, List[gr.update], List[Question], gr.update]:
238
  """
 
233
  self.quiz_generator = QuizGenerator(api_key)
234
  self.certificate_generator = CertificateGenerator()
235
  self.current_questions: List[Question] = []
236
+
237
+ def generate_questions(self, text: str, num_questions: int) -> Tuple[bool, List[Question]]:
238
+ """
239
+ Generate quiz questions using the QuizGenerator
240
+ Returns (success, questions) tuple
241
+ """
242
+ try:
243
+ questions = self.quiz_generator.generate_questions(text, num_questions)
244
+ self.current_questions = questions
245
+ return True, questions
246
+ except Exception as e:
247
+ print(f"Error generating questions: {e}")
248
+ return False, []
249
 
250
  def update_questions(self, text: str, num_questions: int) -> Tuple[gr.update, gr.update, List[gr.update], List[Question], gr.update]:
251
  """