Spaces:
Runtime error
Runtime error
Commit
·
3649714
1
Parent(s):
d14b081
Update app.py
Browse files
app.py
CHANGED
@@ -91,15 +91,15 @@ class SubjectiveTest:
|
|
91 |
# Example usage
|
92 |
data = ' '.join(paragraphs)
|
93 |
noOfQues = 5
|
94 |
-
|
95 |
subjective_generator = SubjectiveTest(data, noOfQues)
|
96 |
question_list = subjective_generator.generate_test("")
|
97 |
questions = []
|
98 |
|
99 |
Quiz = st.form("Quiz")
|
|
|
100 |
for i, question in enumerate(question_list):
|
101 |
if "Explain" not in question and len(tool.check(question)) == 0 and grammar_sense(question) == "Make Sense":
|
102 |
-
st.progress(i)
|
103 |
questions.append(f"{question}")
|
104 |
|
105 |
scores = []
|
@@ -110,17 +110,17 @@ ans = []
|
|
110 |
user_scores = []
|
111 |
|
112 |
for i, question in enumerate(questions):
|
113 |
-
st.progress(i)
|
114 |
res = Quiz.text_input(f'{question}')
|
115 |
ans.append(res)
|
116 |
|
117 |
submit_button = Quiz.form_submit_button("Submit")
|
118 |
|
119 |
if submit_button:
|
|
|
120 |
for i, q in enumerate(questions):
|
121 |
st.progress(i)
|
122 |
result = client.predict(
|
123 |
-
f'What would you rate this answer to the question: "{q}" as a percentage? Here is the answer: {ans[i]}.
|
124 |
0.9,
|
125 |
256,
|
126 |
0.9,
|
@@ -140,5 +140,5 @@ if submit_button:
|
|
140 |
# Calculate the average score using the user_scores list
|
141 |
average_score = sum(user_scores) / len(user_scores)
|
142 |
|
143 |
-
st.
|
144 |
-
|
|
|
91 |
# Example usage
|
92 |
data = ' '.join(paragraphs)
|
93 |
noOfQues = 5
|
94 |
+
st.info("Creating Questions")
|
95 |
subjective_generator = SubjectiveTest(data, noOfQues)
|
96 |
question_list = subjective_generator.generate_test("")
|
97 |
questions = []
|
98 |
|
99 |
Quiz = st.form("Quiz")
|
100 |
+
st.info("Filtering Questions")
|
101 |
for i, question in enumerate(question_list):
|
102 |
if "Explain" not in question and len(tool.check(question)) == 0 and grammar_sense(question) == "Make Sense":
|
|
|
103 |
questions.append(f"{question}")
|
104 |
|
105 |
scores = []
|
|
|
110 |
user_scores = []
|
111 |
|
112 |
for i, question in enumerate(questions):
|
|
|
113 |
res = Quiz.text_input(f'{question}')
|
114 |
ans.append(res)
|
115 |
|
116 |
submit_button = Quiz.form_submit_button("Submit")
|
117 |
|
118 |
if submit_button:
|
119 |
+
st.info("calculating grade")
|
120 |
for i, q in enumerate(questions):
|
121 |
st.progress(i)
|
122 |
result = client.predict(
|
123 |
+
f'What would you rate this answer to the question: "{q}" as a percentage? Here is the answer: {ans[i]}. Your percentage grade cannot be negative or over 100%. Additionally, you should also assume that the user is of a 5-7th grade level of intellect.',
|
124 |
0.9,
|
125 |
256,
|
126 |
0.9,
|
|
|
140 |
# Calculate the average score using the user_scores list
|
141 |
average_score = sum(user_scores) / len(user_scores)
|
142 |
|
143 |
+
st.info(f'Your average score for the answers is {average_score}%')
|
144 |
+
st.write(f'Your average score for the answers is {average_score}%')
|