Spaces:
Runtime error
Runtime error
Commit
·
cc14a13
1
Parent(s):
ed5d2a9
Update app.py
Browse files
app.py
CHANGED
@@ -131,7 +131,6 @@ class SubjectiveTest:
|
|
131 |
|
132 |
return questions
|
133 |
|
134 |
-
# Use st.form to encapsulate the quiz generation and submission
|
135 |
with st.form("quiz_form"):
|
136 |
# Create a button to initiate quiz generation
|
137 |
generate_quiz = st.form_submit_button("Generate Quiz")
|
@@ -151,7 +150,13 @@ if generate_quiz:
|
|
151 |
if not questions:
|
152 |
st.write("No valid questions to process.")
|
153 |
else:
|
|
|
|
|
154 |
# Use the filtered questions in your code
|
|
|
|
|
|
|
|
|
155 |
scores = []
|
156 |
client = Client("https://billbojangeles2000-zephyr-7b-alpha-chatbot-karki.hf.space/")
|
157 |
|
@@ -190,4 +195,4 @@ if generate_quiz:
|
|
190 |
|
191 |
# Calculate and display the average score
|
192 |
average_score = calculate_average(scores)
|
193 |
-
st.write(f'Your average score is {average_score}')
|
|
|
131 |
|
132 |
return questions
|
133 |
|
|
|
134 |
with st.form("quiz_form"):
|
135 |
# Create a button to initiate quiz generation
|
136 |
generate_quiz = st.form_submit_button("Generate Quiz")
|
|
|
150 |
if not questions:
|
151 |
st.write("No valid questions to process.")
|
152 |
else:
|
153 |
+
answers = {} # Dictionary to store answers
|
154 |
+
|
155 |
# Use the filtered questions in your code
|
156 |
+
for i, question in enumerate(questions):
|
157 |
+
res = st.text_input(f'Q{i + 1}: {question}') # Get user input for each question
|
158 |
+
answers[f'Q{i + 1}'] = res # Store the user's answer
|
159 |
+
|
160 |
scores = []
|
161 |
client = Client("https://billbojangeles2000-zephyr-7b-alpha-chatbot-karki.hf.space/")
|
162 |
|
|
|
195 |
|
196 |
# Calculate and display the average score
|
197 |
average_score = calculate_average(scores)
|
198 |
+
st.write(f'Your average score is {average_score}')
|