Rathapoom commited on
Commit
850a798
1 Parent(s): 4dd2b1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -16,7 +16,7 @@ def generate_questions_with_retry(knowledge_material, question_type, cognitive_l
16
  elif question_type == "Fill in the Blank":
17
  num_questions = 10
18
  elif question_type == "True/False":
19
- num_questions = 5
20
  else: # Open-ended
21
  num_questions = 3
22
 
@@ -29,11 +29,12 @@ def generate_questions_with_retry(knowledge_material, question_type, cognitive_l
29
  if question_type != "Fill in the Blank":
30
  prompt += " Provide answers with short explanations."
31
 
 
32
  if question_type == "Multiple Choice" and num_choices:
33
  prompt += f" Each multiple choice question should have {num_choices} choices."
34
 
35
  if question_type == "True/False":
36
- prompt += " Generate True/False questions based on the provided material."
37
 
38
  retries = 0
39
  while retries < max_retries:
@@ -82,6 +83,8 @@ else:
82
  if uploaded_file.size > 5 * 1024 * 1024: # 5 MB limit
83
  st.warning("File size exceeds 5 MB. Please upload a smaller file.")
84
  else:
 
 
85
  st.success("File uploaded successfully! (Text extraction not implemented yet.)")
86
 
87
  # Select question type
 
16
  elif question_type == "Fill in the Blank":
17
  num_questions = 10
18
  elif question_type == "True/False":
19
+ num_questions = 5 # Generate 5 true/false questions
20
  else: # Open-ended
21
  num_questions = 3
22
 
 
29
  if question_type != "Fill in the Blank":
30
  prompt += " Provide answers with short explanations."
31
 
32
+ # Add specific handling for Multiple Choice and True/False
33
  if question_type == "Multiple Choice" and num_choices:
34
  prompt += f" Each multiple choice question should have {num_choices} choices."
35
 
36
  if question_type == "True/False":
37
+ prompt += " Provide short explanations for each question based on the given material, without stating True or False explicitly."
38
 
39
  retries = 0
40
  while retries < max_retries:
 
83
  if uploaded_file.size > 5 * 1024 * 1024: # 5 MB limit
84
  st.warning("File size exceeds 5 MB. Please upload a smaller file.")
85
  else:
86
+ # Here you can add code to extract text from the PDF if needed
87
+ # For simplicity, we're focusing on the text input for now
88
  st.success("File uploaded successfully! (Text extraction not implemented yet.)")
89
 
90
  # Select question type