pgoel90 commited on
Commit
b0cfc76
·
verified ·
1 Parent(s): c211bfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -19
app.py CHANGED
@@ -18,9 +18,8 @@ def create_multiple_choice_prompt(num_questions, quiz_context, expertise):
18
  """Create the prompt template for multiple-choice quiz."""
19
  template = f"""
20
  You are an expert in {expertise}. Generate a quiz with {num_questions} multiple-choice questions that are relevant to {expertise} based on the following content: {quiz_context}.
21
-
22
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
23
-
24
  The format of the quiz is as follows:
25
  - Multiple-choice:
26
  - Questions:
@@ -29,7 +28,6 @@ The format of the quiz is as follows:
29
  b. Answer 2
30
  c. Answer 3
31
  d. Answer 4
32
-
33
  2. <Question2>:
34
  a. Answer 1
35
  b. Answer 2
@@ -56,9 +54,8 @@ def create_true_false_prompt(num_questions, quiz_context, expertise):
56
  """Create the prompt template for true-false quiz."""
57
  template = f"""
58
  You are an expert in {expertise}. Generate a quiz with {num_questions} true-false questions that are relevant to {expertise} based on the following content: {quiz_context}.
59
-
60
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
61
-
62
  The format of the quiz is as follows:
63
  - True-false:
64
  - Questions:
@@ -83,9 +80,8 @@ def create_open_ended_prompt(num_questions, quiz_context, expertise):
83
  """Create the prompt template for open-ended quiz."""
84
  template = f"""
85
  You are an expert in {expertise}. Generate a quiz with {num_questions} open-ended questions that are relevant to {expertise} based on the following content: {quiz_context}.
86
-
87
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
88
-
89
  The format of the quiz is as follows:
90
  - Open-ended:
91
  - Questions:
@@ -103,9 +99,8 @@ def create_fill_in_the_blank_prompt(num_questions, quiz_context, expertise):
103
  """Create the prompt template for fill-in-the-blank quiz."""
104
  template = f"""
105
  You are an expert in {expertise}. Generate a quiz with {num_questions} fill-in-the-blank questions that are relevant to {expertise} based on the following content: {quiz_context}.
106
-
107
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
108
-
109
  The format of the quiz is as follows:
110
  - Fill-in-the-blank:
111
  - Questions:
@@ -126,25 +121,20 @@ def create_mixed_questions_prompt(num_questions, quiz_context, expertise):
126
  """Create the prompt template for a mix of all question types."""
127
  template = f"""
128
  You are an expert in {expertise}. Generate a quiz with exactly {num_questions} questions that include a random mix of multiple-choice, true-false, open-ended, and fill-in-the-blank questions relevant to {expertise} based on the following content: {quiz_context}.
129
-
130
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field. Ensure that the questions are randomly mixed among the different types.
131
-
132
  The format of the quiz is as follows:
133
  - Mixed Questions:
134
  - Questions:
135
  1. <Question1> (Question type):
136
  <Answers if applicable>
137
-
138
  2. <Question2> (Question type):
139
  <Answers if applicable>
140
-
141
  3. <Question3> (Question type):
142
  <Answers if applicable>
143
-
144
  ...
145
  {num_questions}. <Question{num_questions}> (Question type):
146
  <Answers if applicable>
147
-
148
  Example:
149
  - Questions:
150
  1. What is the time complexity of a binary search tree? (Multiple-choice)
@@ -160,14 +150,12 @@ Example:
160
  b. Sample 2
161
  c. Sample 3
162
  d. Sample 4
163
-
164
  - Answers:
165
  1. b
166
  2. True
167
  3. A binary search tree is a data structure used to store data in a sorted manner.
168
  4. hierarchical
169
  5. b
170
-
171
  Note:Ensure there are exactly {num_questions} questions in total with a random mix of question types.Here only template is given if there are more than mentioned example questions generate questions by your own.
172
  """
173
  return template
@@ -198,8 +186,8 @@ def main():
198
  uploaded_file = st.file_uploader("Upload a PDF document", type=["pdf"])
199
  if uploaded_file is not None:
200
  text = extract_text_from_pdf(uploaded_file)
201
- num_questions = st.number_input("Enter the number of questions", min_value=1, max_value=20, value=3)
202
- quiz_type = st.selectbox("Select the type of Question", ["multiple-choice", "true-false", "open-ended", "fill-in-the-blank"]) # "mixed"])
203
  expertise = st.text_input("Enter the domain of the questions to be generated.")
204
 
205
  if st.button("Generate Questions"):
 
18
  """Create the prompt template for multiple-choice quiz."""
19
  template = f"""
20
  You are an expert in {expertise}. Generate a quiz with {num_questions} multiple-choice questions that are relevant to {expertise} based on the following content: {quiz_context}.
 
21
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
22
+ also add a blooms taxonomy skills with each question that is which question is generated on which blooms taxonomy.
23
  The format of the quiz is as follows:
24
  - Multiple-choice:
25
  - Questions:
 
28
  b. Answer 2
29
  c. Answer 3
30
  d. Answer 4
 
31
  2. <Question2>:
32
  a. Answer 1
33
  b. Answer 2
 
54
  """Create the prompt template for true-false quiz."""
55
  template = f"""
56
  You are an expert in {expertise}. Generate a quiz with {num_questions} true-false questions that are relevant to {expertise} based on the following content: {quiz_context}.
 
57
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
58
+ also add a blooms taxonomy skills with each question that is which question is generated on which blooms taxonomy.
59
  The format of the quiz is as follows:
60
  - True-false:
61
  - Questions:
 
80
  """Create the prompt template for open-ended quiz."""
81
  template = f"""
82
  You are an expert in {expertise}. Generate a quiz with {num_questions} open-ended questions that are relevant to {expertise} based on the following content: {quiz_context}.
 
83
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
84
+ also add a blooms taxonomy skills with each question that is which question is generated on which blooms taxonomy.
85
  The format of the quiz is as follows:
86
  - Open-ended:
87
  - Questions:
 
99
  """Create the prompt template for fill-in-the-blank quiz."""
100
  template = f"""
101
  You are an expert in {expertise}. Generate a quiz with {num_questions} fill-in-the-blank questions that are relevant to {expertise} based on the following content: {quiz_context}.
 
102
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field.
103
+ also add a blooms taxonomy skills with each question that is which question is generated on which blooms taxonomy.
104
  The format of the quiz is as follows:
105
  - Fill-in-the-blank:
106
  - Questions:
 
121
  """Create the prompt template for a mix of all question types."""
122
  template = f"""
123
  You are an expert in {expertise}. Generate a quiz with exactly {num_questions} questions that include a random mix of multiple-choice, true-false, open-ended, and fill-in-the-blank questions relevant to {expertise} based on the following content: {quiz_context}.
 
124
  The questions should be at the level of {expertise} and should challenge the knowledge of someone proficient in this field. Ensure that the questions are randomly mixed among the different types.
125
+ also add a blooms taxonomy skills with each question that is which question is generated on which blooms taxonomy.
126
  The format of the quiz is as follows:
127
  - Mixed Questions:
128
  - Questions:
129
  1. <Question1> (Question type):
130
  <Answers if applicable>
 
131
  2. <Question2> (Question type):
132
  <Answers if applicable>
 
133
  3. <Question3> (Question type):
134
  <Answers if applicable>
 
135
  ...
136
  {num_questions}. <Question{num_questions}> (Question type):
137
  <Answers if applicable>
 
138
  Example:
139
  - Questions:
140
  1. What is the time complexity of a binary search tree? (Multiple-choice)
 
150
  b. Sample 2
151
  c. Sample 3
152
  d. Sample 4
 
153
  - Answers:
154
  1. b
155
  2. True
156
  3. A binary search tree is a data structure used to store data in a sorted manner.
157
  4. hierarchical
158
  5. b
 
159
  Note:Ensure there are exactly {num_questions} questions in total with a random mix of question types.Here only template is given if there are more than mentioned example questions generate questions by your own.
160
  """
161
  return template
 
186
  uploaded_file = st.file_uploader("Upload a PDF document", type=["pdf"])
187
  if uploaded_file is not None:
188
  text = extract_text_from_pdf(uploaded_file)
189
+ num_questions = st.number_input("Enter the number of questions", min_value=1, max_value=10, value=3)
190
+ quiz_type = st.selectbox("Select the type of Question", ["multiple-choice", "true-false", "open-ended", "fill-in-the-blank", "mixed"])
191
  expertise = st.text_input("Enter the domain of the questions to be generated.")
192
 
193
  if st.button("Generate Questions"):