Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -254,18 +254,32 @@ def generate_questions_with_retry(username, knowledge_material, question_type, c
|
|
254 |
if not can_generate:
|
255 |
st.error(error_message)
|
256 |
return None
|
257 |
-
|
258 |
# Adjust number of questions based on type
|
259 |
if question_type == "Multiple Choice":
|
260 |
num_questions = 3
|
261 |
format_instructions = f"""
|
262 |
For each multiple choice question:
|
263 |
-
1. Present the question clearly
|
264 |
-
2.
|
265 |
-
3.
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
- The correct answer letter for each question
|
267 |
- A brief explanation of why this is the correct answer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
"""
|
|
|
269 |
elif question_type == "Fill in the Blank":
|
270 |
num_questions = 10
|
271 |
format_instructions = """
|
|
|
254 |
if not can_generate:
|
255 |
st.error(error_message)
|
256 |
return None
|
257 |
+
|
258 |
# Adjust number of questions based on type
|
259 |
if question_type == "Multiple Choice":
|
260 |
num_questions = 3
|
261 |
format_instructions = f"""
|
262 |
For each multiple choice question:
|
263 |
+
1. Present the question clearly, ending with '?'
|
264 |
+
2. Leave one blank line after the question
|
265 |
+
3. Present choices as:
|
266 |
+
A) [choice]
|
267 |
+
B) [choice]
|
268 |
+
C) [choice]
|
269 |
+
{f"D) [choice]" if num_choices > 3 else ""}
|
270 |
+
{f"E) [choice]" if num_choices > 4 else ""}
|
271 |
+
4. After all questions, provide an ANSWER KEY section with:
|
272 |
- The correct answer letter for each question
|
273 |
- A brief explanation of why this is the correct answer
|
274 |
+
|
275 |
+
Example format:
|
276 |
+
1. Your question text here?
|
277 |
+
|
278 |
+
A) First choice
|
279 |
+
B) Second choice
|
280 |
+
C) Third choice
|
281 |
"""
|
282 |
+
|
283 |
elif question_type == "Fill in the Blank":
|
284 |
num_questions = 10
|
285 |
format_instructions = """
|