Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,10 +30,10 @@ def generate_quiz(text, difficulty, num_questions):
|
|
| 30 |
"Adjust the difficulty to {difficulty} level:\n\n"
|
| 31 |
f"{text}\n\n"
|
| 32 |
"Please provide the quiz in the format of:\n"
|
| 33 |
-
"
|
| 34 |
-
"
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
"... and so on. Limit the total number of questions to {num_questions}.")
|
| 38 |
response = model.generate_content(prompt)
|
| 39 |
|
|
@@ -80,8 +80,8 @@ def process_pdf(pdf_file, difficulty, num_questions):
|
|
| 80 |
return f"Error processing PDF: {e}"
|
| 81 |
|
| 82 |
def main():
|
| 83 |
-
st.title("
|
| 84 |
-
st.write("
|
| 85 |
|
| 86 |
if 'generated_quiz' not in st.session_state:
|
| 87 |
st.session_state.generated_quiz = ""
|
|
@@ -109,5 +109,10 @@ def main():
|
|
| 109 |
else:
|
| 110 |
st.error("Please type a question to get an answer.")
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
if __name__ == "__main__":
|
| 113 |
main()
|
|
|
|
| 30 |
"Adjust the difficulty to {difficulty} level:\n\n"
|
| 31 |
f"{text}\n\n"
|
| 32 |
"Please provide the quiz in the format of:\n"
|
| 33 |
+
"Question1: Question 1?\n"
|
| 34 |
+
"Answer1: Answer to Question 1\n"
|
| 35 |
+
"Question2: Question 2?\n"
|
| 36 |
+
"Answer2: Answer to Question 2\n"
|
| 37 |
"... and so on. Limit the total number of questions to {num_questions}.")
|
| 38 |
response = model.generate_content(prompt)
|
| 39 |
|
|
|
|
| 80 |
return f"Error processing PDF: {e}"
|
| 81 |
|
| 82 |
def main():
|
| 83 |
+
st.title("Welcome to ExtraQ!")
|
| 84 |
+
st.write("Please upload an exam or quiz PDF to generate a new quiz with the same style, while having the freedom to change complexity. You can also ask questions based on the generated quiz. This is a student project, with no funds and professional team to follow it regularly, so apologies if any inconvenience happens, I will try my best to improve this project as the time passes by!")
|
| 85 |
|
| 86 |
if 'generated_quiz' not in st.session_state:
|
| 87 |
st.session_state.generated_quiz = ""
|
|
|
|
| 109 |
else:
|
| 110 |
st.error("Please type a question to get an answer.")
|
| 111 |
|
| 112 |
+
|
| 113 |
+
# Add credits section
|
| 114 |
+
st.markdown("---")
|
| 115 |
+
st.markdown("*Developed for NU Students by Mohamed Hafez*")
|
| 116 |
+
|
| 117 |
if __name__ == "__main__":
|
| 118 |
main()
|