mohammed3536 commited on
Commit
92d67dd
1 Parent(s): 3904094

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -27,6 +27,15 @@ def generate_mcqs_on_topic(text, topic, num_mcqs=5):
27
  # Randomly select sentences to create Questions
28
  selected_sentences = random.sample(sentences, min(num_mcqs, len(sentences)))
29
 
 
 
 
 
 
 
 
 
 
30
 
31
 
32
  def generate_question_with_chatgpt(context):
@@ -83,7 +92,7 @@ def main():
83
  # Display the generated Questions
84
  st.success(f"Generated {num_mcqs} Questions:")
85
  for i, question in enumerate(mcqs, start=1):
86
- st.write(f"\nQuestion {i}: {question}")
87
  else:
88
  st.error("Please upload a PDF document.")
89
 
 
27
  # Randomly select sentences to create Questions
28
  selected_sentences = random.sample(sentences, min(num_mcqs, len(sentences)))
29
 
30
+ mcqs = []
31
+ for sentence in selected_sentences:
32
+ # Use ChatGPT for interactive question generation
33
+ chatgpt_question = generate_question_with_chatgpt(sentence)
34
+ mcqs.append(chatgpt_question)
35
+
36
+
37
+ return mcqs
38
+
39
 
40
 
41
  def generate_question_with_chatgpt(context):
 
92
  # Display the generated Questions
93
  st.success(f"Generated {num_mcqs} Questions:")
94
  for i, question in enumerate(mcqs, start=1):
95
+ st.write(f"\nQuestion {i}: {generated_question}")
96
  else:
97
  st.error("Please upload a PDF document.")
98