Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -202,9 +202,9 @@ with tab2:
|
|
| 202 |
else:
|
| 203 |
st.warning("No content available. Upload files first.")
|
| 204 |
|
| 205 |
-
# Generate questions
|
| 206 |
with tab3:
|
| 207 |
-
st.header("Generate Questions")
|
| 208 |
question_type = st.selectbox("Select Question Type", ["MCQs", "Short Questions", "Long Questions", "Fill-in-the-Blank", "Case Study"])
|
| 209 |
num_questions = st.text_input("Total Number of Questions")
|
| 210 |
difficulty_levels = ["Remember", "Understand", "Apply", "Analyze", "Evaluate", "Create"]
|
|
@@ -224,18 +224,26 @@ with tab3:
|
|
| 224 |
""",
|
| 225 |
height=200
|
| 226 |
)
|
| 227 |
-
if num_questions.isdigit() and st.button("Generate Questions"):
|
| 228 |
num_questions = int(num_questions)
|
|
|
|
|
|
|
| 229 |
questions = generate_questions(question_type, st.session_state.get("syllabus_text", ""), num_questions, difficulty, prompt_template)
|
| 230 |
st.session_state["questions"] = questions
|
| 231 |
st.text_area("Generated Questions", questions, height=300)
|
| 232 |
|
| 233 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
st.download_button("Download Questions", questions, file_name="questions.txt")
|
|
|
|
| 235 |
|
| 236 |
# Generate answers
|
| 237 |
with tab4:
|
| 238 |
-
st.header("Generate Answers")
|
| 239 |
if "questions" in st.session_state:
|
| 240 |
if st.button("Generate Answers"):
|
| 241 |
answers = generate_answers(st.session_state["questions"], st.session_state.get("syllabus_text", ""))
|
|
|
|
| 202 |
else:
|
| 203 |
st.warning("No content available. Upload files first.")
|
| 204 |
|
| 205 |
+
# Generate questions and answers
|
| 206 |
with tab3:
|
| 207 |
+
st.header("Generate Questions and Answers")
|
| 208 |
question_type = st.selectbox("Select Question Type", ["MCQs", "Short Questions", "Long Questions", "Fill-in-the-Blank", "Case Study"])
|
| 209 |
num_questions = st.text_input("Total Number of Questions")
|
| 210 |
difficulty_levels = ["Remember", "Understand", "Apply", "Analyze", "Evaluate", "Create"]
|
|
|
|
| 224 |
""",
|
| 225 |
height=200
|
| 226 |
)
|
| 227 |
+
if num_questions.isdigit() and st.button("Generate Questions and Answers"):
|
| 228 |
num_questions = int(num_questions)
|
| 229 |
+
|
| 230 |
+
# Generate questions
|
| 231 |
questions = generate_questions(question_type, st.session_state.get("syllabus_text", ""), num_questions, difficulty, prompt_template)
|
| 232 |
st.session_state["questions"] = questions
|
| 233 |
st.text_area("Generated Questions", questions, height=300)
|
| 234 |
|
| 235 |
+
# Generate answers
|
| 236 |
+
answers = generate_answers(questions, st.session_state.get("syllabus_text", ""))
|
| 237 |
+
st.session_state["answers"] = answers
|
| 238 |
+
st.text_area("Generated Answers", answers, height=300)
|
| 239 |
+
|
| 240 |
+
# Download questions and answers
|
| 241 |
st.download_button("Download Questions", questions, file_name="questions.txt")
|
| 242 |
+
st.download_button("Download Answers", answers, file_name="answers.txt")
|
| 243 |
|
| 244 |
# Generate answers
|
| 245 |
with tab4:
|
| 246 |
+
st.header("Generate Answers (Optional)")
|
| 247 |
if "questions" in st.session_state:
|
| 248 |
if st.button("Generate Answers"):
|
| 249 |
answers = generate_answers(st.session_state["questions"], st.session_state.get("syllabus_text", ""))
|